Package com.aspose.cells

Examples of com.aspose.cells.Cell


    Cells cells = worksheet.getCells();

// === Setting Background Pattern ===

//Accessing cell from the worksheet
Cell cell = cells.get("B2");
Style style = cell.getStyle();

//Setting the foreground color to yellow
style.setBackgroundColor(Color.getYellow());

//Setting the background pattern to vertical stripe
style.setPattern(BackgroundType.VERTICAL_STRIPE);

//Saving the modified style to the "A1" cell.
cell.setStyle(style);

// === Setting Foreground ===

//Adding custom color to the palette at 55th index
Color color = Color.fromArgb(212,213,0);
workbook.changePalette(color,55);

//Accessing the "A2" cell from the worksheet
cell = cells.get("B3");

//Adding some value to the cell
cell.setValue("Hello Aspose!");

//Setting the custom color to the font
style = cell.getStyle();
Font font = style.getFont();
font.setColor(color);

cell.setStyle(style);
   
    //Saving the Excel file
    workbook.save("data/AsposeColors.xls");
   
    System.out.println("Aspose Colors Created.");
View Full Code Here


    sheet.setName("PivotTable");
   
    Cells cells = sheet.getCells();

    //Setting the value to the cells
    Cell cell = cells.get("A1");
    cell.setValue("Sport");
    cell = cells.get("B1");
    cell.setValue("Quarter");
    cell = cells.get("C1");
    cell.setValue("Sales");

    cell = cells.get("A2");
    cell.setValue("Golf");
    cell = cells.get("A3");
    cell.setValue("Golf");
    cell = cells.get("A4");
    cell.setValue("Tennis");
    cell = cells.get("A5");
    cell.setValue("Tennis");
    cell = cells.get("A6");
    cell.setValue("Tennis");
    cell = cells.get("A7");
    cell.setValue("Tennis");
    cell = cells.get("A8");
    cell.setValue("Golf");

    cell = cells.get("B2");
    cell.setValue("Qtr3");
    cell = cells.get("B3");
    cell.setValue("Qtr4");
    cell = cells.get("B4");
    cell.setValue("Qtr3");
    cell = cells.get("B5");
    cell.setValue("Qtr4");
    cell = cells.get("B6");
    cell.setValue("Qtr3");
    cell = cells.get("B7");
    cell.setValue("Qtr4");
    cell = cells.get("B8");
    cell.setValue("Qtr3");

    cell = cells.get("C2");
    cell.setValue(1500);
    cell = cells.get("C3");
    cell.setValue(2000);
    cell = cells.get("C4");
    cell.setValue(600);
    cell = cells.get("C5");
    cell.setValue(1500);
    cell = cells.get("C6");
    cell.setValue(4070);
    cell = cells.get("C7");
    cell.setValue(5000);
    cell = cells.get("C8");
    cell.setValue(6430);

    PivotTableCollection pivotTables = sheet.getPivotTables();

    //Adding a PivotTable to the worksheet
    int index = pivotTables.add("=A1:C8","E3","PivotTable1");
View Full Code Here

TOP

Related Classes of com.aspose.cells.Cell

Copyright © 2018 www.massapicom. 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.