Free Support Forum - aspose.com

Aspose cell setup for java

Hi,
please some one help me out for setting up environment for aspose cell for java

Thanks
Setu

Hi Setu,

Well, Aspose.Cells for Java is packaged into Aspose.Cells.jar file. The component 's package name is "com.aspose.cells", which contains classes, interfaces and other members etc.

I create a simple test file i.e. "HelloWorld.java" into notepad.

import java.io.*;
import com.aspose.cells.*;

class HelloWorld
{


public static void main(String []args)
{

try
{

//Instantiate a Workbook object that represents Excel file.
Workbook wb = new Workbook();
//Note when you create a new workbook, a default worksheet
//"Sheet1" is added (by default) to the workbook.
//Access the first worksheet "Sheet1" in the book.
Worksheet sheet = wb.getWorksheets().getSheet(0);
//Access the "A1" cell in the sheet.
Cell cell = sheet.getCells().getCell("A1");
//Input the "Hello World!" text into the "A1" cell
cell.setValue("Hello World!");
//Save the Excel file.
wb.save("E:\\MyBook.xls",FileFormatType.EXCEL2003);


}

catch(Exception ee)
{

System.out.println(ee);
}


}

}

For comiling and runing the program you may try to use some tool e.g., eclipse and set the path of the .jar file or use the default command prompt of windows to set the env.

e.g.,

e:\>javac -classpath %classpath%;e:\Aspose.Cells.jar; HelloWorld.java
e:\>java -classpath %classpath%;e:\Aspose.Cells.jar; HelloWorld

Note: You may also try to use the environmental variables of windows to premanently set the jdk and Aspose.Cells classpath. e.g., In WinXp, Click System in Control panel, click the Advanced tab in System dialog box, click Environment Variables button to define the variable.

Thank you.

Thanks Amjad.

one more thing i am trying to read data type of cell means which type of data cell congaing but i am not getting any proper method or way fort this thing from aspose cell on line documentation can you please help me for this prob.

Thanks & Regards
Setu

Hi Setu,

Well, you may use Cell.getValueType() method to implement CellValueType interface value and check its type.

Thank you.

hi Amjad thanks its working fine.