Package org.odftoolkit.simple.Document

Examples of org.odftoolkit.simple.Document.OdfMediaType


   
    try {
      String spreadDocPath = ResourceUtilities.getAbsolutePath(TEST_FILE);
      SpreadsheetDocument spreadDoc = SpreadsheetDocument.loadDocument(spreadDocPath);
      Assert.assertNotNull(spreadDoc);
      OdfMediaType odfMediaType = spreadDoc.getOdfMediaType();
      Assert.assertEquals(Document.OdfMediaType.SPREADSHEET_TEMPLATE, odfMediaType);
    } catch (Exception e) {
      LOG.log(Level.SEVERE, e.getMessage(), e);
      Assert.fail(e.getMessage());
    }
View Full Code Here


  public void testGetSuffix() throws Exception{
    try {
      String spreadDocPath = ResourceUtilities.getAbsolutePath(TEST_FILE);
      SpreadsheetDocument spreadDoc = SpreadsheetDocument.loadDocument(spreadDocPath);
      Assert.assertNotNull(spreadDoc);
      OdfMediaType odfMediaType = spreadDoc.getOdfMediaType();
      String suffix = odfMediaType.getSuffix();
      Assert.assertEquals("ots", suffix);
    } catch (Exception e) {
      LOG.log(Level.SEVERE, e.getMessage(), e);
      Assert.fail(e.getMessage());
    }
View Full Code Here

  public void testGetMediaTypeString() throws Exception {
    try {
      TextDocument tdoc = TextDocument.loadDocument(ResourceUtilities.getAbsolutePath(EMPTY_TEXT_DOCUMENT_PATH));
      Assert.assertNotNull(tdoc);
     
      OdfMediaType odfMedia = tdoc.getOdfMediaType();
      String mediaType = odfMedia.getMediaTypeString();
      Assert.assertEquals("application/vnd.oasis.opendocument.text", mediaType);
    } catch (Exception e) {
      LOG.log(Level.SEVERE, e.getMessage(), e);
      Assert.fail(e.getMessage());
    }
View Full Code Here

 
  @Test
  public void testNewTextDocument() throws Exception {
    try {
      TextDocument tdoc = TextDocument.newTextDocument(TextDocument.OdfMediaType.TEXT_MASTER);
      OdfMediaType odfMediaA = tdoc.getOdfMediaType();
      String filePath = ResourceUtilities.getAbsolutePath("");
      tdoc.save(filePath + "testNewTextDocument.odt");

      //validate
      TextDocument tdocument = TextDocument.loadDocument(filePath + "testNewTextDocument.odt");
      OdfMediaType odfMediaB = tdocument.getOdfMediaType();
      Assert.assertEquals(odfMediaA, odfMediaB);
    } catch (Exception e) {
      LOG.log(Level.SEVERE, e.getMessage(), e);
      Assert.fail(e.getMessage());
    }
View Full Code Here

  @Test
  public void testLoadDocumentResource() throws Exception {
    try {
      TextDocument tdocument = TextDocument.loadDocument(ResourceUtilities.getAbsolutePath("headerFooterHidden.odt"));
      Assert.assertNotNull(tdocument);
      OdfMediaType odfMediaB = tdocument.getOdfMediaType();
      Assert.assertEquals("application/vnd.oasis.opendocument.text", odfMediaB.getMediaTypeString());
    } catch (Exception e) {
      LOG.log(Level.SEVERE, e.getMessage(), e);
      Assert.fail(e.getMessage());
    }
   
View Full Code Here

    try {
      String filePath = ResourceUtilities.getAbsolutePath("headerFooterHidden.odt");
      File file = new File(filePath);
      TextDocument tdocument = TextDocument.loadDocument(file);
      Assert.assertNotNull(tdocument);
      OdfMediaType odfMediaB = tdocument.getOdfMediaType();
      Assert.assertEquals("application/vnd.oasis.opendocument.text", odfMediaB.getMediaTypeString());
    } catch (Exception e) {
      LOG.log(Level.SEVERE, e.getMessage(), e);
      Assert.fail(e.getMessage());
    }
   
View Full Code Here

   
    try {
      String spreadDocPath = ResourceUtilities.getAbsolutePath(TEST_FILE);
      SpreadsheetDocument spreadDoc = SpreadsheetDocument.loadDocument(spreadDocPath);
      Assert.assertNotNull(spreadDoc);
      OdfMediaType odfMediaType = spreadDoc.getOdfMediaType();
      Assert.assertEquals(Document.OdfMediaType.SPREADSHEET_TEMPLATE, odfMediaType);
    } catch (Exception e) {
      LOG.log(Level.SEVERE, e.getMessage(), e);
      Assert.fail(e.getMessage());
    }
View Full Code Here

  public void testGetSuffix() throws Exception{
    try {
      String spreadDocPath = ResourceUtilities.getAbsolutePath(TEST_FILE);
      SpreadsheetDocument spreadDoc = SpreadsheetDocument.loadDocument(spreadDocPath);
      Assert.assertNotNull(spreadDoc);
      OdfMediaType odfMediaType = spreadDoc.getOdfMediaType();
      String suffix = odfMediaType.getSuffix();
      Assert.assertEquals("ots", suffix);
    } catch (Exception e) {
      LOG.log(Level.SEVERE, e.getMessage(), e);
      Assert.fail(e.getMessage());
    }
View Full Code Here

  public void testGetMediaTypeString() throws Exception {
    try {
      TextDocument tdoc = TextDocument.loadDocument(ResourceUtilities.getAbsolutePath(EMPTY_TEXT_DOCUMENT_PATH));
      Assert.assertNotNull(tdoc);
     
      OdfMediaType odfMedia = tdoc.getOdfMediaType();
      String mediaType = odfMedia.getMediaTypeString();
      Assert.assertEquals("application/vnd.oasis.opendocument.text", mediaType);
    } catch (Exception e) {
      LOG.log(Level.SEVERE, e.getMessage(), e);
      Assert.fail(e.getMessage());
    }
View Full Code Here

 
  @Test
  public void testNewTextDocument() throws Exception {
    try {
      TextDocument tdoc = TextDocument.newTextDocument(TextDocument.OdfMediaType.TEXT_MASTER);
      OdfMediaType odfMediaA = tdoc.getOdfMediaType();
      String filePath = ResourceUtilities.getAbsolutePath("");
      tdoc.save(filePath + "testNewTextDocument.odt");

      //validate
      TextDocument tdocument = TextDocument.loadDocument(filePath + "testNewTextDocument.odt");
      OdfMediaType odfMediaB = tdocument.getOdfMediaType();
      Assert.assertEquals(odfMediaA, odfMediaB);
    } catch (Exception e) {
      LOG.log(Level.SEVERE, e.getMessage(), e);
      Assert.fail(e.getMessage());
    }
View Full Code Here

TOP

Related Classes of org.odftoolkit.simple.Document.OdfMediaType

Copyright © 2018 www.massapicom. 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.