Free Support Forum -

JAVA save workbook prompt user

In Java is there anyway to save a workbook object (xlsx file), and then prompt the user to open or save the xlsx file, rather than just using to save to the local file system?

something like this but for java


Thanks for using Aspose APIs.

You can convert your workbook into array of bytes using the ByteArrayOutputStream object. Please see the following equivalent code in Java for your reference.


public static byte[] GetWorkbookBuffer() throws Exception {

	Workbook workbook = new Workbook();

	Worksheet worksheet = workbook.getWorksheets().get(0);

	Cell cell = worksheet.getCells().get("A1");

	Cell cell1 = worksheet.getCells().get("A2");
	cell1.putValue("NewName"); baos = new;, SaveFormat.XLSX);

	byte[] buffer = null;
	buffer = baos.toByteArray();

	return buffer;