package AsposeCellsExamples.Introduction;

import com.aspose.cells.Cell;
import com.aspose.cells.SaveFormat;
import com.aspose.cells.Workbook;

import AsposeCellsExamples.Utils;

public class OpeningExistingFile {
	public static void main(String[] args) throws Exception {
		// The path to the documents directory.
		String dataDir = Utils.getSharedDataDir(OpeningExistingFile.class) + "introduction/";
		// Creating a file input stream to reference the license file
		//FileInputStream fstream = new FileInputStream("Aspose.Cells.lic");

		// Create a License object
		//License license = new License();

		// Set the license of Aspose.Cells to avoid the evaluation limitations
		//license.setLicense(fstream);

		// Instantiate a Workbook object that represents an Excel file
		Workbook workbook = new Workbook(dataDir + "book1.xls");

		// Get the reference of "A1" cell from the cells of a worksheet
		Cell cell = workbook.getWorksheets().get(0).getCells().get("A1");

		// Set the "Hello World!" value into the "A1" cell
		cell.setValue("Hello World!");

		// Write the Excel file
		workbook.save(dataDir + "OpeningExistingFile_out.xls");
		workbook.save(dataDir + "OpeningExistingFile_out.xlsx");
		workbook.save(dataDir + "OpeningExistingFile_out.ods");
	}
}
