Closed meSmashsta closed 3 years ago
Try this:
final OdsFactory odsFactory = OdsFactory.create(Logger.getLogger("hello-world"), Locale.US);
final AnonymousOdsFileWriter writer = odsFactory.createWriter();
final OdsDocument document = writer.document();
final Table table = document.addTable("hello-world");
final TableRowImpl row = table.getRow(0);
final TableCell cell = row.getOrCreateCell(0);
cell.setStringValue("Hello, world!");
final ByteArrayOutputStream out = new ByteArrayOutputStream();
writer.save(out);
You can check the result:
System.out.println(Arrays.toString(out.toByteArray()));
Output (depends on the FastODS version you are using):
[80, 75, 3, 4, 10, 0, 0, 8, 0, 0, 37, 126, 118, 81, -123 ...
Try this:
final OdsFactory odsFactory = OdsFactory.create(Logger.getLogger("hello-world"), Locale.US); final AnonymousOdsFileWriter writer = odsFactory.createWriter(); final OdsDocument document = writer.document(); final Table table = document.addTable("hello-world"); final TableRowImpl row = table.getRow(0); final TableCell cell = row.getOrCreateCell(0); cell.setStringValue("Hello, world!"); final ByteArrayOutputStream out = new ByteArrayOutputStream(); writer.save(out);
You can check the result:
System.out.println(Arrays.toString(out.toByteArray()));
Output (depends on the FastODS version you are using):
[80, 75, 3, 4, 10, 0, 0, 8, 0, 0, 37, 126, 118, 81, -123 ...
Ohhhh! Thanks!!! as long as it extends OutputStream it should work, thanks again!
You are welcome.
I don't want to save the file on disk but just want to send them to clients each request since the file is always new.
For example it would be nice to be able to do something like this: