MCPcopy Index your code
hub / github.com/benfry/processing4 / saveODS

Method saveODS

core/src/processing/data/Table.java:1430–1570  ·  view source on GitHub ↗
(OutputStream os)

Source from the content-addressed store, hash-verified

1428
1429
1430 protected void saveODS(OutputStream os) throws IOException {
1431 ZipOutputStream zos = new ZipOutputStream(os);
1432
1433 final String xmlHeader = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>";
1434
1435 ZipEntry entry = new ZipEntry("META-INF/manifest.xml");
1436 String[] lines = new String[] {
1437 xmlHeader,
1438 "<manifest:manifest xmlns:manifest=\"urn:oasis:names:tc:opendocument:xmlns:manifest:1.0\">",
1439 " <manifest:file-entry manifest:media-type=\"application/vnd.oasis.opendocument.spreadsheet\" manifest:version=\"1.2\" manifest:full-path=\"/\"/>",
1440 " <manifest:file-entry manifest:media-type=\"text/xml\" manifest:full-path=\"content.xml\"/>",
1441 " <manifest:file-entry manifest:media-type=\"text/xml\" manifest:full-path=\"styles.xml\"/>",
1442 " <manifest:file-entry manifest:media-type=\"text/xml\" manifest:full-path=\"meta.xml\"/>",
1443 " <manifest:file-entry manifest:media-type=\"text/xml\" manifest:full-path=\"settings.xml\"/>",
1444 "</manifest:manifest>"
1445 };
1446 zos.putNextEntry(entry);
1447 zos.write(PApplet.join(lines, "\n").getBytes());
1448 zos.closeEntry();
1449
1450 /*
1451 entry = new ZipEntry("meta.xml");
1452 lines = new String[] {
1453 xmlHeader,
1454 "<office:document-meta office:version=\"1.0\"" +
1455 " xmlns:office=\"urn:oasis:names:tc:opendocument:xmlns:office:1.0\" />"
1456 };
1457 zos.putNextEntry(entry);
1458 zos.write(PApplet.join(lines, "\n").getBytes());
1459 zos.closeEntry();
1460
1461 entry = new ZipEntry("meta.xml");
1462 lines = new String[] {
1463 xmlHeader,
1464 "<office:document-settings office:version=\"1.0\"" +
1465 " xmlns:config=\"urn:oasis:names:tc:opendocument:xmlns:config:1.0\"" +
1466 " xmlns:office=\"urn:oasis:names:tc:opendocument:xmlns:office:1.0\"" +
1467 " xmlns:ooo=\"http://openoffice.org/2004/office\"" +
1468 " xmlns:xlink=\"http://www.w3.org/1999/xlink\" />"
1469 };
1470 zos.putNextEntry(entry);
1471 zos.write(PApplet.join(lines, "\n").getBytes());
1472 zos.closeEntry();
1473
1474 entry = new ZipEntry("settings.xml");
1475 lines = new String[] {
1476 xmlHeader,
1477 "<office:document-settings office:version=\"1.0\"" +
1478 " xmlns:config=\"urn:oasis:names:tc:opendocument:xmlns:config:1.0\"" +
1479 " xmlns:office=\"urn:oasis:names:tc:opendocument:xmlns:office:1.0\"" +
1480 " xmlns:ooo=\"http://openoffice.org/2004/office\"" +
1481 " xmlns:xlink=\"http://www.w3.org/1999/xlink\" />"
1482 };
1483 zos.putNextEntry(entry);
1484 zos.write(PApplet.join(lines, "\n").getBytes());
1485 zos.closeEntry();
1486
1487 entry = new ZipEntry("styles.xml");

Callers 1

saveMethod · 0.95

Calls 11

joinMethod · 0.95
writeUTFMethod · 0.95
hasColumnTitlesMethod · 0.95
getColumnCountMethod · 0.95
saveStringODSMethod · 0.95
rowsMethod · 0.95
saveNumberODSMethod · 0.95
writeMethod · 0.65
getStringMethod · 0.65
flushMethod · 0.45
closeMethod · 0.45

Tested by

no test coverage detected