Examples of CreationHelper


Examples of org.apache.poi.ss.usermodel.CreationHelper

//                System.out.println(entry.getValue());
//                c.setCellValue(entry.getValue());
            }

            Drawing drawing = s.createDrawingPatriarch();
            CreationHelper factory = eff.wb.getCreationHelper();
            for (Column col : labels) {
//                System.out.println("label="+(c.getNumber()-1));
//                System.out.println( Arrays.toString(labels.get(c).toArray(new String[0])));
//                System.out.println(r[0]);
//                System.out.println(r[0].getCell(c.getNumber()-1));
View Full Code Here

Examples of org.apache.poi.ss.usermodel.CreationHelper

            }
        }

        private void addCommentsToColumns() {
            Drawing drawing = s.createDrawingPatriarch();
            CreationHelper factory = eff.wb.getCreationHelper();

            for (Column col : labels) {
                int columnIndex = col.getNumber() - 1;

                eff.addAllCommentsToOneCell(drawing, factory, rows[0].getCell(columnIndex), labels.get(col).toArray(new String[0]));
View Full Code Here

Examples of org.apache.poi.ss.usermodel.CreationHelper

        File.separator + "WithMoreVariousData.xlsx"
    );
    assertTrue(xml.exists());
     
    XSSFWorkbook workbook = new XSSFWorkbook(xml.toString());
    CreationHelper createHelper = workbook.getCreationHelper();
    assertEquals(3, workbook.getNumberOfSheets());
    XSSFSheet sheet = (XSSFSheet)workbook.getSheetAt(0);

    // Check hyperlinks
    assertEquals(4, sheet.getNumHyperlinks());
    doTestHyperlinkContents(sheet);
   
   
    // Write out, and check

    // Load up again, check all links still there
    XSSFWorkbook wb2 = XSSFTestDataSamples.writeOutAndReadBack(workbook);
    assertEquals(3, wb2.getNumberOfSheets());
    assertNotNull(wb2.getSheetAt(0));
    assertNotNull(wb2.getSheetAt(1));
    assertNotNull(wb2.getSheetAt(2));
   
    sheet = (XSSFSheet)wb2.getSheetAt(0);

   
    // Check hyperlinks again
    assertEquals(4, sheet.getNumHyperlinks());
    doTestHyperlinkContents(sheet);
   
   
    // Add one more, and re-check
    Row r17 = sheet.createRow(17);
    Cell r17c = r17.createCell(2);
   
    Hyperlink hyperlink = createHelper.createHyperlink(Hyperlink.LINK_URL);
    hyperlink.setAddress("http://poi.apache.org/spreadsheet/");
    hyperlink.setLabel("POI SS Link");
    r17c.setHyperlink(hyperlink);
   
    assertEquals(5, sheet.getNumHyperlinks());
View Full Code Here

Examples of org.apache.poi.ss.usermodel.CreationHelper

    doTestHyperlinkContents(sheet);
  }

  public void testLoadSave() {
    XSSFWorkbook workbook = XSSFTestDataSamples.openSampleWorkbook("WithMoreVariousData.xlsx");
    CreationHelper createHelper = workbook.getCreationHelper();
    assertEquals(3, workbook.getNumberOfSheets());
    XSSFSheet sheet = workbook.getSheetAt(0);

    // Check hyperlinks
    assertEquals(4, sheet.getNumHyperlinks());
    doTestHyperlinkContents(sheet);


    // Write out, and check

    // Load up again, check all links still there
    XSSFWorkbook wb2 = XSSFTestDataSamples.writeOutAndReadBack(workbook);
    assertEquals(3, wb2.getNumberOfSheets());
    assertNotNull(wb2.getSheetAt(0));
    assertNotNull(wb2.getSheetAt(1));
    assertNotNull(wb2.getSheetAt(2));

    sheet = wb2.getSheetAt(0);


    // Check hyperlinks again
    assertEquals(4, sheet.getNumHyperlinks());
    doTestHyperlinkContents(sheet);


    // Add one more, and re-check
    Row r17 = sheet.createRow(17);
    Cell r17c = r17.createCell(2);

    Hyperlink hyperlink = createHelper.createHyperlink(Hyperlink.LINK_URL);
    hyperlink.setAddress("http://poi.apache.org/spreadsheet/");
    hyperlink.setLabel("POI SS Link");
    r17c.setHyperlink(hyperlink);

    assertEquals(5, sheet.getNumHyperlinks());
View Full Code Here

Examples of org.apache.poi.ss.usermodel.CreationHelper

  }
 
  public void exportToXLS(JSONObject worksheetJSON, OutputStream stream) throws JSONException, IOException, SerializationException{
    WorkSheetXLSExporter exporter = new WorkSheetXLSExporter();
    HSSFWorkbook wb = new HSSFWorkbook();
    CreationHelper createHelper = wb.getCreationHelper();

    int sheetsNumber = worksheetJSON.getInt(SHEETS_NUM);
    JSONArray exportedSheets = worksheetJSON.getJSONArray(EXPORTED_SHEETS);
    for (int i = 0; i < sheetsNumber; i++) {
      JSONObject sheetJ = exportedSheets.getJSONObject(i);
View Full Code Here

Examples of org.apache.poi.ss.usermodel.CreationHelper

   */
  public Workbook export(JSONObject json) throws JSONException {
   
    Workbook wb = new HSSFWorkbook();
    Sheet sheet = wb.createSheet("new sheet");
    CreationHelper createHelper = wb.getCreationHelper();
      fillSheet(sheet, json, createHelper);   
    return wb;
  }
View Full Code Here

Examples of org.apache.poi.ss.usermodel.CreationHelper

    // TODO Auto-generated constructor stub
  }
 
  public Workbook exportInExcel(){
    Workbook wb = new HSSFWorkbook();
      CreationHelper createHelper = wb.getCreationHelper();
      Sheet sheet = wb.createSheet("new sheet");
      for(int j = 0; j < 50; j++){
      sheet.createRow(j);
    }
      fillSheet(sheet, wb, createHelper);
View Full Code Here

Examples of org.apache.poi.ss.usermodel.CreationHelper

     * XSSFSheet autoSizeColumn() on empty RichTextString fails
     */
    public void test48325() {
        XSSFWorkbook wb = new XSSFWorkbook();
        XSSFSheet sheet = wb.createSheet("Test");
        CreationHelper factory = wb.getCreationHelper();

        XSSFRow row = sheet.createRow(0);
        XSSFCell cell = row.createCell(0);

        XSSFFont font = wb.createFont();
        RichTextString rts = factory.createRichTextString("");
        rts.applyFont(font);
        cell.setCellValue(rts);

        sheet.autoSizeColumn(0);
    }
View Full Code Here

Examples of org.apache.poi.ss.usermodel.CreationHelper

      
       // Sheet 1 doesn't (yet)
       assertNull(sh1.getCommentsTable(false));
      
       // Try to add comments to Sheet 1
       CreationHelper factory = wb.getCreationHelper();
       Drawing drawing = sh1.createDrawingPatriarch();

       ClientAnchor anchor = factory.createClientAnchor();
       anchor.setCol1(0);
       anchor.setCol2(4);
       anchor.setRow1(0);
       anchor.setRow2(1);

       Comment comment1 = drawing.createCellComment(anchor);
       comment1.setString(
             factory.createRichTextString("I like this cell. It's my favourite."));
       comment1.setAuthor("Bob T. Fish");
      
       Comment comment2 = drawing.createCellComment(anchor);
       comment2.setString(
             factory.createRichTextString("This is much less fun..."));
       comment2.setAuthor("Bob T. Fish");

       Cell c1 = sh1.getRow(0).createCell(4);
       c1.setCellValue(2.3);
       c1.setCellComment(comment1);
View Full Code Here

Examples of org.apache.poi.ss.usermodel.CreationHelper

                HSSFSheet sheet = resultCell.getSheet();
                HSSFWorkbook workbook = sheet.getWorkbook();

                int pictureIdx = workbook.addPicture(image.imageContent, Workbook.PICTURE_TYPE_JPEG);

                CreationHelper helper = workbook.getCreationHelper();
                ClientAnchor anchor = helper.createClientAnchor();
                anchor.setCol1(resultCell.getColumnIndex());
                anchor.setRow1(resultCell.getRowIndex());
                anchor.setCol2(resultCell.getColumnIndex());
                anchor.setRow2(resultCell.getRowIndex());
                if (patriarch == null) {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.