作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
下面是我的代码
DocsService client = new DocsService("testappv1");
client.setUserCredentials(username, password);
client.setProtocolVersion(DocsService.Versions.V2);
File file = new File("C:/test.jpg");
DocumentEntry newDocument = new DocumentEntry();
newDocument.setTitle(new PlainTextConstruct("test"));
String mimeType = DocumentListEntry.MediaType.fromFileName(file.getName()).getMimeType();
newDocument.setMediaSource(new MediaFileSource(file, mimeType));
newDocument = client.insert(destFolderUrl, newDocument);
文档创建成功,但未包含任何内容。
最佳答案
尝试以下操作
client.insert(new URL("https://docs.google.com/feeds/documents/private/full/?convert=false"), newDocument);
我认为 ?convert=false
位很重要,不知道在没有 url 的情况下你是怎么做到的
client.insert(new URL(destFolderUrl+ "?convert=false"), newDocument);
希望对你有用
关于java - 无法通过 java api 将图像文件上传到 Google Doc,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10170579/
我是一名优秀的程序员,十分优秀!