Donato <ct003006 <at> mediaset.it> writes:
>
> Nick Burch <nick.burch <at> alfresco.com> writes:
>
> >
> > On Wed, 23 Feb 2011, Donato wrote:
> > > Ok, I'll try to use the POIXMLDocument class (which is the superclass of a
> > > XSSFWorkbook, if I'm right). A question: I'm creating workbook objects as
> > >
> > > Workbook wb = new HSSFWorkbook(myfile.xls)
> > > or
> > > Workbook wb = new XSSFWorkbook(myfile.xlsx)
> > >
> > > Are there any difference, especially for the XSSFTable I'm interested
> > > in, between these declarations and HSSFWorkbook wb = ... or XSSFWorkbook
> > > wb = ... ?
> >
> > It'll only work for XSSFWorkbook, as it's a XSSF specific feature
> >
> > Nick
> >
>
> Hello Nick,
>
> I opened the bug 50829 in Bugzilla.
> I was not able to get table relations even trying to use POIXMLDocument.
>
> Thanks!
> Donato
>
Hello Nick, many many thanks for your very fast solution of the bug 50829.
I had a look a the new getTables() method you've added and I copied the code in
my page. With that I was able to get all table info and also to update tables.
The only minor problem is that if a conditional formatting is applied to the
table, its range is not updated when the table range is (but I think this is
not a topic of tables but it is related to a lack of support for conditional
formatting in XSSFSheet, isn't it?).
This is the code I used to update a table (once extraced):
String cell_start = table.getStartCellReference
( ).formatAsString( );
CellReference cell_end = table.getEndCellReference( );
int new_row = cell_end.getRow( ) + 10; //just to add 10 rows
int new_col = cell_end.getCol( );
String cell_new = (new CellReference(new_row,
new_col)).formatAsString( );
table.getCTTable( ).setRef(cell_start + ":" + cell_new);
Using setRef, the table1.xml file is updated, but the xml for the sheet
(containing a conditional formatting) is not. Do you know any workaround for
this, or a better way to update a table range?
My goal is to populate an empty table (with only columns and styles defined)
with data I retrieve from a db, so I add an unknown number of rows and I'd like
to extend the table accordingly.
Thanks again,
bye
Donato
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]