java.lang.IllegalStateException: Unknown file format. (Word-ML)


#1

Is it supported in Aspose.Words JAVA 1.0 ?


#2

Thank you for your interest in Aspose.Words for Java.

WordML is not yet supported in our Java and .NET versions, but we are working on import and export for WordML. It could be available within 3 months.


#3

Working on hudge project. Have to generate docs from templates.

Templates are build using WordML (drag & drop from XSD, InferenceTool), data is extracted from Oracle in xml format, then XSLT. But the result is in WordML. And for complex document template with fragments, I need a business logic to build the final doc out of WordML generated blocks.

I guess .NET version will be available sooner ?


#4

Yes, the .NET version will come out first. But this module will not be hard to port to Java for us, it will follow shortly.

Just want to hear an opinion from you about what do you expect from a library to deal with WordML files? There is a point of view that WordML is just XML and any XML library, such as System.Xml or dom4j will be enough to work with it. There is another point of view that WordML is very hard to deal with at such a low level. So what do you personally expect from Aspose.Words in terms of dealing with WordML?


#5

Be able to open the doc in WordML format, look for bookmarks or fields, replace them with simple formated text (bold, italic, bullet, underline). Final format can be usual doc format.

PS : I've tried getText from Document class, text has lost its format, do I have to dig to Paragraph to preserve format. And if I have several Paragraphs, how to invoke setText on Bookmark object to preserve as much as possible format ?


#6

getText() returns just a plain string of course.

If you use Bookmark.setText, it replaces the text of the bookmark with your new text. The new text takes on the format of the text that was at the start of the bookmark. I'm not so sure what else do you mean by preserving the format in this case.

If you want to insert formatted text into a bookmark, you can use DocumentBuilder.moveToBookmark() and then DocumentBuilder.write(), writeln(), DocumentBuilder.getFont() properties etc. or even DocumentBuilder.insertHtml() if you have formatted text as html.

You can of course work with individual Run and Paragraph nodes, create and modify them and their formatting too.