Examples of Cells


Examples of com.aspose.cells.Cells

    Workbook book = new Workbook();

    //Obtaining the reference of the newly added worksheet
    int sheetIndex = book.getWorksheets().add();
    Worksheet worksheet = book.getWorksheets().get(sheetIndex);
    Cells cells = worksheet.getCells();
    Cell cell = null;

    //Adding a value to "A1" cell
    cell = cells.get("A1");
    cell.setValue(1);

    //Adding a value to "A2" cell
    cell = cells.get("A2");
    cell.setValue(2);

    //Adding a value to "A3" cell
    cell = cells.get("A3");
    cell.setValue(3);

    //Adding a SUM formula to "A4" cell
    cell = cells.get("A4");
    cell.setFormula("=SUM(A1:A3)");

    //Calculating the results of formulas
    book.calculateFormula();
View Full Code Here

Examples of com.aspose.cells.Cells

  {
    //Instantiate a new workbook
    Workbook workbook = new Workbook("data/book1.xls");
   
    //Get the Cells collection in the first worksheet
    Cells cells = workbook.getWorksheets().get(0).getCells();
   
    //Create a cellarea i.e.., B3:C19
    CellArea ca = new CellArea();
    ca.StartRow = 2;
    ca.StartColumn =1;
    ca.EndRow = 18;
    ca.EndColumn = 2;
   
    //Apply subtotal, the consolidation function is Sum and it will applied to
    //Second column (C) in the list
    cells.subtotal(ca, 0, ConsolidationFunction.SUM, new int[] { 1 });
   
    //Save the excel file
    workbook.save("data/AsposeTotal.xls");
   
    // Print message
View Full Code Here

Examples of com.aspose.cells.Cells

    //Set the name of worksheet
    sheet.setName("Data");

    //Get the cells collection in the sheet.
    Cells cells = workbook.getWorksheets().get(0).getCells();

    //Put some values into a cells of the Data sheet.
    cells.get("A1").setValue("Region");
    cells.get("A2").setValue("France");
    cells.get("A3").setValue("Germany");
    cells.get("A4").setValue("England");
    cells.get("A5").setValue("Sweden");
    cells.get("A6").setValue("Italy");
    cells.get("A7").setValue("Spain");
    cells.get("A8").setValue("Portugal");
    cells.get("B1").setValue("Sale");
    cells.get("B2").setValue(70000);
    cells.get("B3").setValue(55000);
    cells.get("B4").setValue(30000);
    cells.get("B5").setValue(40000);
    cells.get("B6").setValue(35000);
    cells.get("B7").setValue(32000);
    cells.get("B8").setValue(10000);

    //Create chart
    int chartIndex = sheet.getCharts().add(ChartType.COLUMN, 12, 1, 33, 12);
    Chart chart = sheet.getCharts().get(chartIndex);
View Full Code Here

Examples of com.aspose.cells.Cells

    //Instantiating a Workbook object
    Workbook workbook = new Workbook();
   
    //Accessing the added worksheet in the Excel file
    Worksheet worksheet = workbook.getWorksheets().get(0);
    Cells cells = worksheet.getCells();
   
    cells.get("A1").setValue("Hello World"); //Adding a string value to the cell
    cells.get("A2").setValue(20.5); //Adding a double value to the cell
    cells.get("A3").setValue(15); //Adding an integer  value to the cell
    cells.get("A4").setValue(true); //Adding a boolean value to the cell
   
    Cell cell = cells.get("A5"); //Adding a date/time value to the cell
    cell.setValue(java.util.Calendar.getInstance());
   
    //Setting the display format of the date
    Style style = cell.getStyle();
    style.setNumber(15);
View Full Code Here

Examples of com.aspose.cells.Cells

   
    //Create a Worksheet and get the first sheet.
    Worksheet worksheet = wbk.getWorksheets().get(0);
   
    //Create a Cells object to fetch all the cells.
    Cells cells = worksheet.getCells();
   
    //Merge some Cells (C6:E7) into a single C6 Cell.
    cells.merge(5,2,2,3);
   
    //Input data into C6 Cell.
    worksheet.getCells().get(5,2).setValue("This is a test of merging");
   
    //Save the Workbook.
View Full Code Here

Examples of com.aspose.cells.Cells

    //Instantiating a Workbook object
    Workbook workbook = new Workbook();

    //Accessing the worksheet in the Excel file
    Worksheet worksheet = workbook.getWorksheets().get(0);
    Cells cells = worksheet.getCells();

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

    //Adding some value to the "A1" cell
    cell.setValue("Visit Aspose @ www.aspose.com!");
    Style style = cell.getStyle();
View Full Code Here

Examples of com.aspose.cells.Cells

    //Instantiating a Workbook object
    Workbook workbook = new Workbook();

    //Accessing the worksheet in the Excel file
    Worksheet worksheet = workbook.getWorksheets().get(0);
    Cells cells = worksheet.getCells();

    //Adding some value to cell
    Cell cell = cells.get("A1");
    cell.setValue("This is Aspose test of fonts!");

    //Setting the font name to "Times New Roman"
    Style style = cell.getStyle();
    Font font = style.getFont();
View Full Code Here

Examples of com.aspose.cells.Cells

    //Instantiating a Workbook object
    Workbook workbook = new Workbook();

    //Accessing the added worksheet in the Excel file
    Worksheet worksheet = workbook.getWorksheets().get(0);
    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
View Full Code Here

Examples of com.aspose.cells.Cells

  {
    Workbook workbook = new Workbook("data/workbook.xls");
   
    //Accessing the first worksheet in the Excel file
    Worksheet worksheet = workbook.getWorksheets().get(0);
    Cells cells = worksheet.getCells();
   
    cells.hideRow(2); //Hiding the 3rd row of the worksheet
    cells.hideColumn(1); //Hiding the 2nd column of the worksheet
   
    //Saving the modified Excel file in default (that is Excel 2003) format
    workbook.save("data/hideUnhideCells_Aspose.xls");

        //Print message
View Full Code Here

Examples of com.aspose.cells.Cells

    //Obtaining the reference of the newly added worksheet
    Worksheet sheet = workbook.getWorksheets().get(0);
    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
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.