我想使用Apache POI将文件从*. fidus(Fidus Writer)平台转换为*. docx格式,反之亦然。
在*。fidus文件我需要将一些属性作为扩展属性或自定义属性存储在*。docx文件,然后我可以在需要将其转换回*时检索它们。菲德斯。
因此,我想知道如何使用POI的CustomProperties类或类似的东西向docx文件添加一些属性。还可以使用POI将自定义属性(扩展属性)添加到docx文件中的段落中吗?
提前感谢。
自<代码>*。docx文档是基于XML
的,我们必须使用POIXMLProperties。自定义属性
,请参阅http://poi.apache.org/apidocs/org/apache/poi/POIXMLProperties.CustomProperties.html.
例子:
import java.io.*;
import org.apache.poi.*;
import org.apache.poi.xwpf.usermodel.*;
import org.openxmlformats.schemas.officeDocument.x2006.customProperties.CTProperty;
import java.util.GregorianCalendar;
public class DocumentProperties {
public static void main(String[] args) throws IOException {
XWPFDocument document = new XWPFDocument(new FileInputStream("This is a Test.docx"));
POIXMLProperties properties = document.getProperties();
//http://poi.apache.org/apidocs/org/apache/poi/POIXMLProperties.html
//prints the core property Creator:
System.out.println(properties.getCoreProperties().getCreator());
//prints the extendend property Application:
System.out.println(properties.getExtendedProperties().getApplication());
//sets a custom property
POIXMLProperties.CustomProperties customproperties = properties.getCustomProperties();
if (!customproperties.contains("Test")) {
customproperties.addProperty("Test", 123);
}
CTProperty ctproperty = customproperties.getProperty("Test");
System.out.println(ctproperty);
System.out.println(ctproperty.getI4());
//the above customproperties.addProperty() can only set boolean, double, integer or string properties
//the CTProperty contains more possibitities
if (!customproperties.contains("Test Date")) {
customproperties.addProperty("Test Date", 0);
ctproperty = customproperties.getProperty("Test Date");
ctproperty.unsetI4();
ctproperty.setFiletime(new GregorianCalendar(2016,1,13));
}
ctproperty = customproperties.getProperty("Test Date");
System.out.println(ctproperty);
System.out.println(ctproperty.getFiletime());
FileOutputStream out = new FileOutputStream(new File("This is a Test.docx"));
document.write(out);
}
}
POIXMLProperties。CustomProperties.add属性()
只能设置布尔、双、整数或字符串属性,但基础的CTProperty
包含更多可能性。
有关CTProperty
的信息,请参见http://grepcode.com/file/repo1.maven.org/maven2/org.apache.poi/ooxml-schemas/1.1/org/openxmlformats/schemas/officeDocument/x2006/customProperties/CTProperty.java#CTProperty.
我扩展了JavaFX按钮,如下所示: 现在我希望能够在我的FXML中使用它。大概是这样的: 我如何做到这一点。
我正在使用wordpress 4.1与ACF v4。我有一个添加了自定义字段的自定义帖子类型,每次添加新类别时都需要添加新的自定义字段。如果我自动添加类别“轿车”,我必须添加自定义字段“轿车”。我可以使用插件函数执行此操作吗?或者我必须用代码,在数据库中插入来做到这一点?提前致谢!!
我正在尝试添加一个自定义字段到忍者表单(第3.3节)。到处都找不到完整的例子。 仔细查看代码,似乎过滤器'ninja_forms_register_fields'可以起到作用,但我无法让它在任何地方运行。
我有一个扩展类的类,它看起来像: 问题是,我可以向添加自定义吗?我浏览了和中可用的所有方法,但没有找到任何方法。但是在模式下,我发现在中有的列表。如何在此添加自定义?
目前 Mars 支持自定义 xlog 的加密部分和长短连协议加解包部分。需要强调的是想要自定义这些扩展,需要在本地编译 Mars 才可以,编译方法见 Mars Android 接入指南 和 Mars iOS/OS X 接入指南 中的编译部分。切记,在自定义实现时,可以增加函数,但是不能删除头文件中已有的函数,也不能修改头文件中的函数原型。 自定义 xlog 加密 xlog 的具体实现可以参考微信终
我试图设置一些段落或文本在. docx文件使用Apache POI,我正在读取一个. docx文件作为模板从WEB-INF/资源/模板文件夹内我的战争文件,一旦读取,我想创建动态更多的表后,第9表用作模板,我可以添加更多的表格,但其他类型的内容(段落)被安排在文档的其他部分?有必要的形式来做这件事吗?
问题内容: 如何添加类似于命令行功能的扩展属性,但是如何在内核中通过自定义系统调用来实现。我看了一下,尝试从内核空间进行任何设置都没有运气。每当我使用它时,它都会重新引导整个VM。最后,我尝试将新的整数类型作为扩展属性添加到文件,并且我还将需要检索该扩展属性。我需要使用内核空间中允许的功能。 问题答案: 我能得到工作的扩展属性: 主要的问题是需要一个传递。该代码看起来像这样: 我也能够开始工作。缓
如何向后端的joomla组件添加更多选项卡和字段, -尝试编辑视图xml文件添加更多的字段集,没有成功-尝试编辑视图管理组件中的编辑文件,没有成功, 有什么帮助吗?