我想保存一个TextDocument
通过 OpenOffice.org UNO 创建到磁盘上的文件。做这个的最好方式是什么?
编辑:这是我最终使用的 C# 代码。document
is an XTextDocument
.
protected void Save (string path)
{
string url = "file://" + path;
PropertyValue [] propertyValues = {
new PropertyValue {
Name = "FilterName",
Value = new Any ("writer8")
}
};
((XStorable) document).storeAsURL (url, propertyValues);
}
Use XStorable.storeToURL() http://api.openoffice.org/docs/common/ref/com/sun/star/frame/XStorable.html#storeToURL(或 storeAsURL)。
编辑:你需要通过FilterName
与输出格式。示例(Python 中,因为这样更简单):
properties = ( PropertyValue('FilterName', 0, 'writer8', 0), )
document.storeToURL('file:///path/to/document.odt', properties)
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)