Stephan Wunderlich wrote:
Hi Thomas,

I’m using the following code snippet to get contents of word documents as strings:

XTextDocument xTextDocument = (XTextDocument) UnoRuntime.queryInterface(

                                    XTextDocument.class, xComp);

String s = xTextDocument.getText().getString();

This seems to work fine for documents up to around 5MB in size and just return “” for larger documents. Anybody have an idea of why I get this problem? Maybe you need to set available memory somewhere, I tried –Xmx1024m as a jvm argument but still fails with no exception.

Could it be that the text you get is just to large for a java.lang.String ? ... As far as I know this holds a maximum of 2147483646 characters.

What also might be a problem here is that much OOo application C++ code internally still uses String classes from module tools that only handle strings up to a length of 2^32 characters, instead of 2^63.

-Stephan

To ensure that you get it in smaller portions you could enumerate over what you get from xTextDocument.getText and then get the Strings of these portions.

Hope that helps

Regards

Stephan

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to