Page 1 of 1

Which methods to use for the deprecated ones

PostPosted: Wed Mar 30, 2016 12:21 am
by aditya3494
I came across certain methods like
Code: Select all
wmlPackage.filter(filterSettings);


Code: Select all
org.docx4j.wml.Document wmlDocumentEl = wmlPackage.getMainDocumentPart().getJaxbElement();


Now in these .filter() and .getJaxbElement() are deprecated. I am using 3.2.1 version of docx4j. Can u please suggest me what would be the replacement method for these. These are just a few and I have 3-4 more for which I need to know the now-recommended methods which currently are deprecated. Although the stuff works but the support might be taken away. Can u tell me or direct me to a place where I get to know what all method to use for the ones deprecated.

Re: Which methods to use for the deprecated ones

PostPosted: Fri Jun 16, 2017 10:16 pm
by schlebe
Hello,

it's my second post :-) and I'm interesting to find a solution to read a Excel Cell.

On web, I have found the following solution ...

Code: Select all
String s = oSharedString.getJaxbElement().getSi().get(Integer.parseInt(c.getV())).getT() );


But, I work with version 3.3.3 and the getJaxbElement() function is deprecated !!!

Like aditya3494, I'm interesting to know what to do to replace this function ... and to simply read a Excel cell value of type "S".

It is perhaps not necessary to pass by SharedStrings XML file but I find nothing in forum and on Web except using getJaxbElement() function.

Thanks for any help.

Re: Which methods to use for the deprecated ones

PostPosted: Fri Jun 16, 2017 10:38 pm
by jason

Re: Which methods to use for the deprecated ones

PostPosted: Mon Jul 03, 2017 5:13 pm
by schlebe
Hello Jason,

I have read your post but that doesn't help me ! :(

In following expression, I have replaced getJaxbElement() by getContents()

Code: Select all
s = oSharedString.getJaxbElement().getSi().get(Integer.parseInt(c.getV())).getT();


Code: Select all
s = oSharedString.getContents().getSi().get(Integer.parseInt(c.getV())).getT();


But compiler doesn't compile because getSi() is unknow !

QUESTION: what is the correct syntax ?

RESPONSE: I have continue to search before posting this message and I have found that I can write following line of code

Code: Select all
CTSst sst = (CTSst)oSharedString.getContents();
String s = sst.getSi().get(Integer.parseInt(c.getV())).getT().getValue();


where c value is obtained with following line of code

Code: Select all
for (org.xlsx4j.sml.Row r : data.getSheetData().getRow())
    {
    org.xlsx4j.sml.Cell c = r.getC().get(0);