sure sure, here we go thank you for your help I try to go for it to give you a clear "problem".
DISPLAY
with this file temp.ods, if I don't use the section :
OfficeBody ob = doc.getBody();
List<OfficeSpreadsheet> os = ob.getOfficeSpreadsheets();
List<TableTable> tt = os.get(0).getTables();
tt.get(0).setTablePrintRanges("A1:M12");
Two case, if I select the print from openoffice from area before AA, it's
fine
if I select the area after AA, its not working
*java.lang.NumberFormatException: For input string: "AE12"
at
java.lang.NumberFormatException.forInputString(NumberFormatException.java:48)
at java.lang.Integer.parseInt(Integer.java:447)*
if I use the section
OfficeBody ob = doc.getBody();
List<OfficeSpreadsheet> os = ob.getOfficeSpreadsheets();
List<TableTable> tt = os.get(0).getTables();
tt.get(0).setTablePrintRanges("A1:Z12");
It's working well for the first line but the 11th other lines are not
displayed
if you go over Z, it's not working
tt.get(0).setTablePrintRanges("A1:AB12");
*Exception in thread "main" java.lang.NumberFormatException: For input
string: "AB12"
at
java.lang.NumberFormatException.forInputString(NumberFormatException.java:48)
*
AND FOR THE PRINT (uncomment in the main() ).
DefaultDocumentPrinter printer = new DefaultDocumentPrinter();
printer.print(doc);
Just nothing happen when I click ok on the print dialog
I hope I can help you cause I think your api is magic
On Sat, May 30, 2009 at 8:45 PM, Guillaume Maillard <
[email protected]> wrote:
> Hi,
> Could you provide us the document and the associated source code?
>
> Regards,
> Guillaume
>
> 2009/5/30 fourky <[email protected]>
>
>>
>> thanks for your quick response. I had a search on your source file,
>> and I think there is a little mistake on the
>> Tabletable.setTablePrintRanges :
>> final String substring = vr.substring(vl.length() -
>> this.printStopRow);
>> Shouldn't you use
>> final String substring = vr.substring(vr.length() -
>> this.printStopRow);
>>
>> cause when I specify a range that stays in the "one letter", it works
>> fine. But it's not working with a $A$1:$AK$11
>>
>>
>> To specify a "right" range don't solve my printing problem. Still,
>> nothing happen when I click OK from the print dialog.
>> can be really cool of you if you can help me with that.
>> thanks
>>
>>
>>
>> - Hide quoted text -
>>
>>
>>
>>
>>
>>
>> On Sat, May 30, 2009 at 7:11 PM, jOpenDocument, Guillaume
>> <[email protected]> wrote:
>>
>> Hi,
>>
>> The easy way is to define "print ranges" in the document with
>> OpenOffice.
>> setTablePrintRanges uses the same syntax
>>
>> Regards,
>> Guillaume
>>
>> PS: please use the mailing list for questions
>>
>> Hi, I try to use your API, but when I want to display the .ods
>> file, I just see the first cell. When I print from the display
>> windows, only the first characters of the first cell are printed. I
>> saw your response saying to use
>> use setTablePrintRanges (See TableTable.java
>> (org.jopendocument.model.table) )
>> but I cannot find how to use it.
>> But my main problem is to print. When I use the print example
>> you gave on the web site, the print dialog appear, I click OK but
>> nothing appen.
>> I am a bit lost.
>> I would really like to use your API and I find it awesome for
>> everything ( reading and writing on ods file, printing is easy to
>> use).
>> Thanks for your help and have a good week end
>> Xavier Fourcade
>> [email protected] <mailto:[email protected]>
>>
>>
>
package TestImpression2;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.Date;
import java.util.List;
import javax.swing.JFrame;
import javax.swing.table.DefaultTableModel;
import javax.swing.table.TableModel;
import org.jopendocument.dom.spreadsheet.Sheet;
import org.jopendocument.dom.spreadsheet.SpreadSheet;
import org.jopendocument.model.OpenDocument;
import org.jopendocument.model.office.OfficeBody;
import org.jopendocument.model.office.OfficeSpreadsheet;
import org.jopendocument.model.table.TableTable;
import org.jopendocument.panel.ODSViewerPanel;
import org.jopendocument.print.DefaultDocumentPrinter;
public class TestImpression2 {
/**
* @param args
*/
public static void main(String[] args) {
// PrintFile();
ViewFile();
}
private static void ViewFile(){
// Load the spreadsheet.
final OpenDocument doc = new OpenDocument();
doc.loadFrom("C:/test.ods");
// Show time !
final JFrame mainFrame = new JFrame("Viewer");
DefaultDocumentPrinter printer = new DefaultDocumentPrinter();
ODSViewerPanel viewerPanel = new ODSViewerPanel(doc, printer, true);
OfficeBody ob = doc.getBody();
List<OfficeSpreadsheet> os = ob.getOfficeSpreadsheets();
List<TableTable> tt = os.get(0).getTables();
tt.get(0).setTablePrintRanges("A1:AB12");
mainFrame.setContentPane(viewerPanel);
mainFrame.pack();
mainFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
mainFrame.setLocation(10, 10);
mainFrame.setVisible(true);
}
private static void PrintFile(){
// Load the spreadsheet.
final OpenDocument doc = new OpenDocument();
doc.loadFrom("C:/test.ods");
// Print !
DefaultDocumentPrinter printer = new DefaultDocumentPrinter();
printer.print(doc);
}
}
test.ods
Description: application/vnd.oasis.opendocument.spreadsheet
