Page 1 of 1

Openoffice xlsx files

PostPosted: Thu Feb 09, 2012 2:19 am
by harpritt
Hi all

I was just wondering if anyone else was unable to open an xlsx file generated by xlsx4j in Openoffice.

Openoffice states it can http://www.openoffice.org/dev_docs/features/3.2/

When i open the file generated in the sample CreateSimpleSpreadsheet.java I get a blank document.

I have attached the xlsx file

Thank you in advance, any and all help is appreciated.

Harpritt

Re: Openoffice xlsx files

PostPosted: Thu Feb 09, 2012 11:47 pm
by harpritt
Looks like i needed to at the r attribute to cell. I should have read the specs.

Does anyone have a nice way of generating the r value for a cell?

Re: Openoffice xlsx files

PostPosted: Fri Feb 10, 2012 1:03 am
by harpritt
Code: Select all
public static String getCellReference(int columnNumber,int rowNumber){
      return getExcelColumnName(columnNumber)+ rowNumber;
   }

   public static String getExcelColumnName(int columnNumber) {
      int dividend = columnNumber;
      String columnName = "";
      int modulo;
      while (dividend > 0) {
         modulo = (dividend - 1) % 26;
         columnName = Character.toChars(65 + modulo)[0] + columnName;
         dividend = (int) ((dividend - modulo) / 26);
      }
      return columnName;
   }