I'd like to save a TextDocument
created through OpenOffice.org UNO to a file on the disk. What is the best way to do this?
Edit: This is the C# code that I ended up using. 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() (or storeAsURL).
Edit: You need to pass a FilterName
with the output format. Example (in Python 'cause that's simpler):
properties = ( PropertyValue('FilterName', 0, 'writer8', 0), )
document.storeToURL('file:///path/to/document.odt', properties)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.