GcExcel Java API reference is available through Maven Central Repository, a directory that stores all the java archives (.jar files) and adds libraries, plugins and references to your project.
For installation of the product, refer to the following steps:
You can either download the GcExcel java package (gcexcel-3.1.0.jar) from Maven Central repository or download it locally on your machine from GrapeCity website.
Complete the following steps to install the GcExcel Java package (gcexcel-3.1.0.jar) and add dependency for GcExcel Java library in your application.
If you are creating an application :
You can install any Java IDE - Eclipse or IntelliJ as per your choice. Shared below are the steps to create a Java application using Eclipse IDE:
Open the build.gradle and append the following script in the dependencies block:
compile("com.grapecity.documents:gcexcel:3.1.0") |
Open the pom.xml and add below xml element in the dependencies node.
<dependency> <groupId>com.grapecity.documents</groupId> <artifactId>gcexcel</artifactId> <version>3.1.0</version> </dependency> |
The jar file will be added as a library in the project and your project can now reference all classes of GcExcel in the jar file.
To create a basic application with GcExcel Java, refer to the following tasks:
In Main.java, import the following namespaces:
import com.grapecity.documents.excel.*; import com.grapecity.documents.excel.drawing.*; |
Create a new workbook and add a worksheet using the following code:
Workbook workbook = new Workbook(); IWorksheet worksheet = workbook.getWorksheets().get(0); |
After your workbook is created, you can set the tab color and customize the default row height and column width of the worksheet as per your preferences. An example code is shown below:
worksheet.setTabColor('Color.getGreen()'); worksheet.setStandardHeight(20); worksheet.setStandardWidth(50); |
When you are done, you can save the workbook with the desired name and provide the required path. An example code is shown below:
workbook.save("GcExcelFeatures.xlsx"); |
You can view the saved GcExcelFeatures.xlsx file at the specified location.