Logo Search packages:      
Sourcecode: jexcelapi version File versions  Download package

void jxl::demo::Write::write (  )  throws IOException, WriteException [inline]

Uses the JExcelAPI to create a spreadsheet

Exceptions:
IOException 
WriteException 

Definition at line 102 of file Write.java.

References jxl::write::WritableWorkbook::addNameArea(), jxl::write::WritableWorkbook::close(), jxl::write::WritableWorkbook::createSheet(), filename, jxl::Sheet::getSettings(), jxl::write::WritableWorkbook::setColourRGB(), jxl::WorkbookSettings::setLocale(), jxl::SheetSettings::setPrintArea(), workbook, jxl::write::WritableWorkbook::write(), writeBordersSheet(), writeDateFormatSheet(), writeFormulaSheet(), writeImageSheet(), writeLabelFormatSheet(), writeLabelsSheet(), and writeNumberFormatSheet().

Referenced by jxl::demo::Demo::main().

  {
    WorkbookSettings ws = new WorkbookSettings();
    ws.setLocale(new Locale("en", "EN"));
    workbook = Workbook.createWorkbook(new File(filename), ws);


    WritableSheet s2 = workbook.createSheet("Number Formats", 0);
    WritableSheet s3 = workbook.createSheet("Date Formats", 1);
    WritableSheet s1 = workbook.createSheet("Label Formats", 2);
    WritableSheet s4 = workbook.createSheet("Borders", 3);
    WritableSheet s5 = workbook.createSheet("Labels", 4);
    WritableSheet s6 = workbook.createSheet("Formulas", 5);
    WritableSheet s7 = workbook.createSheet("Images", 6);
    //    WritableSheet s8 = workbook.createSheet
    //      ("'Illegal chars in name !*%^?': which exceeds max name length",7);

    // Modify the colour palette to bright red for the lime colour
    workbook.setColourRGB(Colour.LIME, 0xff, 0, 0);

    // Add a named range to the workbook
    workbook.addNameArea("namedrange", s4, 1, 11, 5, 14);
    workbook.addNameArea("validation_range", s1, 4, 65, 9, 65);
    workbook.addNameArea("formulavalue", s6, 1, 45, 1, 45);

    // Add a print area to the "Labels" sheet
    s5.getSettings().setPrintArea(4,4,15,35);

    writeLabelFormatSheet(s1);
    writeNumberFormatSheet(s2);
    writeDateFormatSheet(s3);
    writeBordersSheet(s4);
    writeLabelsSheet(s5);
    writeFormulaSheet(s6);
    writeImageSheet(s7);

    workbook.write();
    workbook.close();
  }


Generated by  Doxygen 1.6.0   Back to index