Examples of Cells


Examples of com.aspose.cells.Cells

    //Adding a new worksheet to the Workbook object
    WorksheetCollection worksheets = workbook.getWorksheets();
    Worksheet worksheet = worksheets.add("My Worksheet");
   
    Cells cells = worksheet.getCells();

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

    //Saving the Excel file
      workbook.save("data/xlsx4j/newWorksheet_Aspose.xls");
     
View Full Code Here

Examples of com.aspose.cells.Cells

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

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

    //Setting the height of all rows in the worksheet to 8
    worksheet.getCells().setStandardHeight(8f);
   
    //Setting the height of the second row to 40
    cells.setRowHeight(1, 40);

    //Saving the modified Excel file in default (that is Excel 2003) format
    workbook.save(System.getProperty("user.dir") + "/data/xlsx4j/RowHeight-Aspose.xlsx");
   
    //Print Message
View Full Code Here

Examples of com.aspose.cells.Cells

        // Obtaining the reference of the first worksheet
        WorksheetCollection worksheets = workbook.getWorksheets();
        Worksheet sheet = worksheets.get(0);

        // Adding some sample value to cells
        Cells cells = sheet.getCells();
        Cell cell = cells.get("A1");
        cell.setValue(50);
        cell = cells.get("A2");
        cell. setValue (100);
        cell = cells.get("A3");
        cell.setValue(150);
        cell = cells.get("B1");
        cell.setValue(4);
        cell = cells.get("B2");
        cell.setValue(20);
        cell = cells.get("B3");
        cell.setValue(50);

        ChartCollection charts = sheet.getCharts();

        // Adding a chart to the worksheet
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

   
    //Accessing the first worksheet in the Excel file
    Worksheet worksheet = workbook.getWorksheets().get(0);
   
    //Finding the cell containing the specified formula
    Cells cells = worksheet.getCells();
   
    //Instantiate FindOptions
    FindOptions findOptions = new FindOptions();
   
    //Finding the cell containing a string value that starts with "Or"
    findOptions.setLookAtType(LookAtType.START_WITH);
   
    Cell cell = cells.find("SH",null,findOptions);
   
    //Printing the name of the cell found after searching worksheet
    System.out.println("Name of the cell containing String: " + cell.getName());
  }
View Full Code Here

Examples of com.aspose.cells.Cells

   
    //Accessing the first worksheet in the Excel file
    Worksheet worksheet = workbook.getWorksheets().get(0);
   
    //Finding the cell containing the specified formula
    Cells cells = worksheet.getCells();
   
    //Instantiate FindOptions
    FindOptions findOptions = new FindOptions();
   
    //Finding the cell containing a string value that starts with "Or"
    findOptions.setLookAtType(LookAtType.START_WITH);
   
    Cell cell = cells.find("SH",null,findOptions);
   
    //Printing the name of the cell found after searching worksheet
    System.out.println("Name of the cell containing String: " + cell.getName());
  }
View Full Code Here

Examples of com.aspose.cells.Cells

        // Obtaining the reference of the first worksheet
        WorksheetCollection worksheets = workbook.getWorksheets();
        Worksheet sheet = worksheets.get(0);

        // Adding some sample value to cells
        Cells cells = sheet.getCells();
        Cell cell = cells.get("A1");
        cell.setValue(50);
        cell = cells.get("A2");
        cell. setValue (100);
        cell = cells.get("A3");
        cell.setValue(150);
        cell = cells.get("B1");
        cell.setValue(4);
        cell = cells.get("B2");
        cell.setValue(20);
        cell = cells.get("B3");
        cell.setValue(50);

        ChartCollection charts = sheet.getCharts();

        // Adding a chart to the worksheet
View Full Code Here

Examples of com.aspose.cells.Cells

    //==================================================
    //Creating an array containing names as string values
    String[] names = new String[]{"laurence chen", "roman korchagin", "kyle huang"};
   
    //Importing the array of names to 1st row and first column vertically
    Cells cells = worksheet.getCells();
    cells.importArray(names,0,0,false);
   
    //==================================================
    ArrayList<String> list = new ArrayList<String>();
   
    //Add few names to the list as string values
    list.add("laurence chen");
    list.add("roman korchagin");
    list.add("kyle huang");
   
    //Importing the contents of ArrayList to 1st row and first column vertically
    cells.importArrayList(list,2,0,true);
    //==================================================
   
    //Saving the Excel file
    workbook.save("data/AsposeDataImport.xls");
  }
View Full Code Here

Examples of com.aspose.cells.Cells

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

    //Obtain the DataSorter object in the workbook
    DataSorter sorter = workbook.getDataSorter();
   
    //Set the first order
View Full Code Here

Examples of com.aspose.cells.Cells

  public static void main(String[] args) throws Exception
  {
    //Instantiating a Workbook object
    Workbook workbook = new Workbook("data/workbook.xls");
   
    Cells cells = workbook.getWorksheets().get(0).getCells();
    Cell cell = cells.get("A12");
   
    //Tracing precedents of the cell A12.
    //The return array contains ranges and cells.
    ReferredAreaCollection ret = cell.getPrecedents();
   
    //Printing all the precedent cells' name.
    if(ret != null)
    {
      for(int m = 0 ; m < ret.getCount(); m++)
      {
        ReferredArea area = ret.get(m);
        StringBuilder stringBuilder = new StringBuilder();
        if (area.isExternalLink())
        {
            stringBuilder.append("[");
            stringBuilder.append(area.getExternalFileName());
            stringBuilder.append("]");
         }
         stringBuilder.append(area.getSheetName());
         stringBuilder.append("!");
         stringBuilder.append(CellsHelper.cellIndexToName(area.getStartRow(), area.getStartColumn()));
         if (area.isArea())
          {
              stringBuilder.append(":");
              stringBuilder.append(CellsHelper.cellIndexToName(area.getEndRow(), area.getEndColumn()));
          }
          System.out.println("Tracing Precedents: " + stringBuilder.toString());
       }
    }
   
    //Get the A1 cell
    Cell c = cells.get("A5");
    //Get the all the Dependents of A5 cell
    Cell[] dependents = c.getDependents(true);
    for (int i = 0; i< dependents.length; i++)
    {
         System.out.println("Tracing Dependents: " + dependents[i].getWorksheet().getName() +dependents[i].getName() + ":" + dependents[i].getIntValue());
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.