(OutputStream os)
| 1408 | |
| 1409 | |
| 1410 | protected void saveODS(OutputStream os) throws IOException { |
| 1411 | ZipOutputStream zos = new ZipOutputStream(os); |
| 1412 | |
| 1413 | final String xmlHeader = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"; |
| 1414 | |
| 1415 | ZipEntry entry = new ZipEntry("META-INF/manifest.xml"); |
| 1416 | String[] lines = new String[] { |
| 1417 | xmlHeader, |
| 1418 | "<manifest:manifest xmlns:manifest=\"urn:oasis:names:tc:opendocument:xmlns:manifest:1.0\">", |
| 1419 | " <manifest:file-entry manifest:media-type=\"application/vnd.oasis.opendocument.spreadsheet\" manifest:version=\"1.2\" manifest:full-path=\"/\"/>", |
| 1420 | " <manifest:file-entry manifest:media-type=\"text/xml\" manifest:full-path=\"content.xml\"/>", |
| 1421 | " <manifest:file-entry manifest:media-type=\"text/xml\" manifest:full-path=\"styles.xml\"/>", |
| 1422 | " <manifest:file-entry manifest:media-type=\"text/xml\" manifest:full-path=\"meta.xml\"/>", |
| 1423 | " <manifest:file-entry manifest:media-type=\"text/xml\" manifest:full-path=\"settings.xml\"/>", |
| 1424 | "</manifest:manifest>" |
| 1425 | }; |
| 1426 | zos.putNextEntry(entry); |
| 1427 | zos.write(PApplet.join(lines, "\n").getBytes()); |
| 1428 | zos.closeEntry(); |
| 1429 | |
| 1430 | /* |
| 1431 | entry = new ZipEntry("meta.xml"); |
| 1432 | lines = new String[] { |
| 1433 | xmlHeader, |
| 1434 | "<office:document-meta office:version=\"1.0\"" + |
| 1435 | " xmlns:office=\"urn:oasis:names:tc:opendocument:xmlns:office:1.0\" />" |
| 1436 | }; |
| 1437 | zos.putNextEntry(entry); |
| 1438 | zos.write(PApplet.join(lines, "\n").getBytes()); |
| 1439 | zos.closeEntry(); |
| 1440 | |
| 1441 | entry = new ZipEntry("meta.xml"); |
| 1442 | lines = new String[] { |
| 1443 | xmlHeader, |
| 1444 | "<office:document-settings office:version=\"1.0\"" + |
| 1445 | " xmlns:config=\"urn:oasis:names:tc:opendocument:xmlns:config:1.0\"" + |
| 1446 | " xmlns:office=\"urn:oasis:names:tc:opendocument:xmlns:office:1.0\"" + |
| 1447 | " xmlns:ooo=\"http://openoffice.org/2004/office\"" + |
| 1448 | " xmlns:xlink=\"http://www.w3.org/1999/xlink\" />" |
| 1449 | }; |
| 1450 | zos.putNextEntry(entry); |
| 1451 | zos.write(PApplet.join(lines, "\n").getBytes()); |
| 1452 | zos.closeEntry(); |
| 1453 | |
| 1454 | entry = new ZipEntry("settings.xml"); |
| 1455 | lines = new String[] { |
| 1456 | xmlHeader, |
| 1457 | "<office:document-settings office:version=\"1.0\"" + |
| 1458 | " xmlns:config=\"urn:oasis:names:tc:opendocument:xmlns:config:1.0\"" + |
| 1459 | " xmlns:office=\"urn:oasis:names:tc:opendocument:xmlns:office:1.0\"" + |
| 1460 | " xmlns:ooo=\"http://openoffice.org/2004/office\"" + |
| 1461 | " xmlns:xlink=\"http://www.w3.org/1999/xlink\" />" |
| 1462 | }; |
| 1463 | zos.putNextEntry(entry); |
| 1464 | zos.write(PApplet.join(lines, "\n").getBytes()); |
| 1465 | zos.closeEntry(); |
| 1466 | |
| 1467 | entry = new ZipEntry("styles.xml"); |
no test coverage detected