当我们上传包含带有text-indent
段落的html内容时,它们似乎没有反映在文档中。是因为文本缩进在Google文档中被转换为span标签吗?仅当test-indent为负值时才会发生这种情况。
我们使用下面的代码上传html内容
try (InputStream in = new ByteArrayInputStream(htmlContent.getBytes())) {
File fileMetaData = new File();
fileMetaData.setMimeType(mimeType);
InputStreamContent inputStreamContent = new InputStreamContent(DocumentMimeType.HTML.toString(), in);
File updatedFile = drive.files()
.update(fileId, fileMetaData, inputStreamContent)
.setFields("id")
.execute();
Map<String, String> meta = new HashMap<>();
return meta;
}
下面是具有引用格式的html:
<html><body><p style="text-align: center;">Works Cited</p><p style="line-height:2em;text-indent:-24px;padding-left:24px;margin-top:2em;">"ACCENTURE & ORACLE DEPLOY CLOUD FOR WM POLICE." <i>Worldwide Databases</i>, vol. 30, no. 2, Jan. 2018, pp. 5-8. <i>ContentSelect Research Navigator</i>.</p><p style="line-height:2em;text-indent:-24px;padding-left:24px;margin-top:2em;">Flanagan, John Clemans, et al. <i>Science</i>. Westinghouse Learning Press, 1971.</p><p style="line-height:2em;text-indent:-24px;padding-left:24px;margin-top:2em;">Holton, Gerald. "Centennial Focus: Millikan's Measurement of Planck's Constant." <i>Focus</i>, vol. 3, 1999, doi:10.1103/physrevfocus.3.23.</p><p style="line-height:2em;text-indent:-24px;padding-left:24px;margin-top:2em;">"SCIFORMIX COLLABORATES WITH ORACLE HEALTH SCIENCES." <i>Worldwide Databases</i>, vol. 29, no. 12, 2017, pp. 3-7. <i>ContentSelect Research Navigator</i>.</p></body></html>