Looks like POI does not have a way to get
to the repeating rows and columns. So you
probably will need to modify source.
Here's some information that may help you:
1. User code:
fileInputStream = // get the input
HSSFWorkbook w = new HSSFWorkbook(fileInputStream);
HSSFName name = w.getNameAt(w.getNameIndex("Print_Titles"));
// Note: "Print_Titles" is a fixed value that you will
// need to use to get to the NameRecord for Repeating
// Rows and Cols
2. And then to get the repeating rows and columns:
AreaReference repeatingRows
= new AreaReference(name.getUnionReference()[0]);
AreaReference repeatingCols
= new AreaReference(name.getUnionReference()[1]);
3. Ofcourse, HSSFName.getUnionReference() does not exist, so you will
have to add it as:
public String[] getUnionReference() {
return name.getAreaUnionReference(book);
}
4. And since NameRecord.getAreaUnionReference(book) does not exist
either, you can add it in NameRecord.java as:
public String[] getAreaUnionReference(Workbook book) {
String[] result = null;
if (field_13_name_definition != null
&& !field_13_name_definition.isEmpty()) {
Stack ptgStack = (Stack) field_13_name_definition.clone();
switch (ptgStack.size()) {
case 4:
Ptg ptg = (Ptg) ptgStack.pop();
if (ptg.getClass() == UnionPtg.class) {
result = new String[2];
Area3DPtg aptg0 = (Area3DPtg) ptgStack.pop();
Area3DPtg aptg1 = (Area3DPtg) ptgStack.pop();
result[0] = aptg0.toFormulaString(book);
result[1] = aptg1.toFormulaString(book);
}
break;
case 1:
result = new String[1];
// TODO: check class
Area3DPtg aptg0 = (Area3DPtg) ptgStack.pop();
result[0] = aptg0.toFormulaString(book);
break;
}
}
return result;
}
Hope that helps,
~ amol
PS: At the moment I'm not sure thats the best way to
do it so I wont be putting up a patch for it, but
give it a try and see how it works for you. I have tried
it for basic cases and it seems to work both for reading
from POI generated workbooks and excel generated workbooks.
> -----Original Message-----
> From: KH Lim [mailto:[EMAIL PROTECTED]
> Sent: Thursday, September 08, 2005 8:53 AM
> To: [email protected]
> Subject: HSSF: getter for repeating rows and columns
>
>
> Hi,
>
> Has anyone looked into writing a getter for repeating rows
> and columns before? If so could you share the tips to
> implement it?
>
> Currently only the setter
> (HSSFWorkbook.setRepeatingRowsAndColumns) is available.
>
> Thx!
>
> __________________________________
> Take an action against poverty
> http://pr.mail.yahoo.co.jp/whiteband/
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> Mailing List: http://jakarta.apache.org/site/mail2.html#poi
> The Apache Jakarta Poi Project: http://jakarta.apache.org/poi/
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
Mailing List: http://jakarta.apache.org/site/mail2.html#poi
The Apache Jakarta Poi Project: http://jakarta.apache.org/poi/