Package com.aspose.cells

Examples of com.aspose.cells.Cell


    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");
     
      //Print Message
View Full Code Here


    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

        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
        int chartIndex = charts.add(ChartType.PYRAMID,5,0,15,5);
View Full Code Here

    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

        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
        int chartIndex = charts.add(ChartType.PYRAMID,5,0,15,5);
View Full Code Here

  {
    //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

    //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();

    //Saving the Excel file
View Full Code Here

    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);
    cell.setStyle(style);
   
    workbook.save("data/DataInCells_Aspose.xls"); //Saving the Excel file

// Print message
System.out.println("Data Added Successfully");
View Full Code Here

    //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();

    //Setting the line of the top border
    style.setBorder(BorderType.TOP_BORDER,CellBorderType.THICK,Color.getBlack());

    //Setting the line of the bottom border
    style.setBorder(BorderType.BOTTOM_BORDER,CellBorderType.THICK,Color.getBlack());

    //Setting the line of the left border
    style.setBorder(BorderType.LEFT_BORDER,CellBorderType.THICK,Color.getBlack());

    //Setting the line of the right border
    style.setBorder(BorderType.RIGHT_BORDER,CellBorderType.THICK,Color.getBlack());

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

    //Saving the Excel file
    workbook.save("data/AsposeBorders.xls");

    System.out.println("Aspose Borders Created.");
View Full Code Here

    //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();
    font.setName("Courier New");
    font.setSize(24);
    font.setBold(true);
    font.setUnderline(FontUnderlineType.SINGLE);
    font.setColor(Color.getBlue());
    font.setStrikeout(true);
    //font.setSubscript(true);

    cell.setStyle(style);

    //Saving the modified Excel file in default format
    workbook.save("data/AsposeFonts.xls");
   
    System.out.println("Aspose Fonts Created.");
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.