Package org.odftoolkit.odfdom.doc

Examples of org.odftoolkit.odfdom.doc.OdfDocument.save()


    File tmpFile2 = ResourceUtilities.newTestOutputFile(TARGET_STEP_2);
    File tmpFile3 = ResourceUtilities.newTestOutputFile(TARGET_STEP_3);
    OdfDocument doc = null;
    try {
      doc = OdfSpreadsheetDocument.newSpreadsheetDocument();
      doc.save(tmpFile1);
      doc.close();
    } catch (Exception ex) {
      LOG.log(Level.SEVERE, mImagePath, ex);
      Assert.fail();
    }
View Full Code Here


          } else {
            meta.setGenerator("ODFDOM/SNAPSHOT(" + timeStamp + ")");
            validTest = false;
          }
          LOG.log(Level.INFO, "Updating the resource {0}", odfFile.getPath());
          odfDoc.save(odfFile.getPath());
        }
      }
      Assert.assertTrue("No meta:generator could be set as the System property 'odfdom.version' set by the Maven pom.xml was not found!", validTest);

      //ToDO: Add validation test afterwards..
View Full Code Here

      image.setXlinkHrefAttribute("Pictures/myHoliday.jpg");
      frame.appendChild(image);

      TextPElement para = (TextPElement) xpath.evaluate("//text:p[1]", contentDom, XPathConstants.NODE);
      para.appendChild(frame);
      doc.save(TEST_FILE_FOLDER + New_File);
      doc.close();

      //Test if the image has been inserted
      doc = OdfDocument.loadDocument(TEST_FILE_FOLDER + New_File);
      contentDom = doc.getContentDom();
View Full Code Here

          } else {
            meta.setGenerator("ODFDOM/SNAPSHOT(" + timeStamp + ")");
            validTest = false;
          }
          LOG.log(Level.INFO, "Updating the resource {0}", odfFile.getPath());
          odfDoc.save(odfFile.getPath());
        }
      }
      Assert.assertTrue("No meta:generator could be set as the System property 'odfdom.version' set by the Maven pom.xml was not found!", validTest);

      //ToDO: Add validation test afterwards..
View Full Code Here

    File tmpFile2 = ResourceUtilities.newTestOutputFile(TARGET_STEP_2);
    File tmpFile3 = ResourceUtilities.newTestOutputFile(TARGET_STEP_3);
    OdfDocument doc = null;
    try {
      doc = OdfSpreadsheetDocument.newSpreadsheetDocument();
      doc.save(tmpFile1);
      doc.close();
    } catch (Exception ex) {
      LOG.log(Level.SEVERE, mImagePath, ex);
      Assert.fail();
    }
View Full Code Here

    File tmpFile = ResourceUtilities.newTestOutputFile("PackagePassword.ods");
    OdfDocument doc = null;
    try {
      doc = OdfSpreadsheetDocument.newSpreadsheetDocument();
      doc.getPackage().setPassword("password");
      doc.save(tmpFile);
      doc.close();
      OdfPackage odfPackage = OdfPackage.loadPackage(tmpFile, "password", null);
      byte[] contentBytes = odfPackage.getBytes("content.xml");
      Assert.assertNotNull(contentBytes);
    } catch (Exception ex) {
View Full Code Here

      memorylabel[3 * i + 1] = "parse " + TEST_FILE_NAME[i];
      memorylabel[3 * i + 2] = "save " + TEST_FILE_NAME[i];
    }
    updateTableCells(memorydoc, "Memory footprint", memoryfootprint, memorylabel);

    timedoc.save(time_spreadsheet);
    LOG.log(Level.INFO, "[PerformaceTest] Test results are written to {0}", time_spreadsheet);
    memorydoc.save(memory_spreadsheet);
    LOG.log(Level.INFO, "[PerformaceTest] Test results are written to {0}", memory_spreadsheet);
  }

View Full Code Here

    for (int j = 0; j < TEST_FILE_NAME.length; j++) {
      filename = TEST_FILE_FOLDER + TEST_FILE_NAME[j];
      LOG.log(Level.INFO, "filename:{0}", filename);
      doc = OdfDocument.loadDocument(filename);
      dom = doc.getContentDom();
      doc.save(filename);
    }
  }

  private void test() throws Exception {
    long start, end;
View Full Code Here

          memoryfootprint[3 * j + 1] = Runtime.getRuntime().totalMemory()
              - Runtime.getRuntime().freeMemory();
        }

        start = System.currentTimeMillis();
        doc.save(filename);
        end = System.currentTimeMillis();
        totalSaveTimeForEach[j] += end - start;
        totalTime[2] += end - start;

        doc = null;
View Full Code Here

        OdfDocument childDoc = embeddedDocs.get(childDocPath);
        String embedFileName = childDoc.getDocumentPath();
        OdfMediaType embedMediaType = OdfMediaType.getOdfMediaType(childDoc.getMediaTypeString());
        //use '_' replace '/', because '/' is not the valid char in file path
        embedFileName = embedFileName.replaceAll("/", "_") + "." + embedMediaType.getSuffix();
        childDoc.save(TEST_FILE_FOLDER + embedFileName);
        LOG.log(Level.INFO, "Save file : {0}", TEST_FILE_FOLDER + embedFileName);
        OdfDocument embeddedDoc = OdfDocument.loadDocument(ResourceUtilities.getAbsolutePath(embedFileName));
        Assert.assertEquals(embeddedDoc.getMediaTypeString(), embedMediaType.getMediaTypeString());
      }
    } catch (Exception ex) {
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.