I would like to replace placeholders in an array inside a .docx text file.
With previous versions of OpenOffice it worked fine. But with the latest versions it doesn’t work anymore. The versions I tried on are 7.5.1.2 and 7.5.4.1
The previous version it worked with was 6.0
I’m not allowed to put images so you have to think of an array whose first column title is name
This is what I get now [all data is reported on one line]
name
name1, name2, name3
This is what I would like to achieve [each data is reported on a new line]
name
name1
name2
name3
I work in C# under windows and using the debugger I found the point where the behavior of OpenOffice changes
This is the method where the problem arises
private XTextTable GetBookmarkTable(string bookmarkName)
{
XBookmarksSupplier xBookmarksSupplier = mDoc as XBookmarksSupplier;
XNameAccess xNamedBookmarks = xBookmarksSupplier.getBookmarks();
Any bMark = xNamedBookmarks.getByName(bookmarkName);
XTextContent xBookmarkContent = ((Any)bMark).Value as XTextContent;
XTextRange xBookmarkRange = xBookmarkContent.getAnchor();
XEnumerationAccess iacc = xBookmarkRange as XEnumerationAccess;
XEnumeration xe = iacc.createEnumeration();
while (xe.hasMoreElements())
{
Any t = xe.nextElement();
if (t.Value is XTextTable)
{
XTextTable readerTable = t.Value as XTextTable;
return readerTable;
}
}
return null;
}
In the old version the t.Value is XTextTable test returned true while with the new versions it returns false
How can I fix the problem?
Thanks a lot to everyone
Domenico Giuseppe Sala