Package org.openoffice.xmerge

Examples of org.openoffice.xmerge.ConvertData


        }

        // create a ConvertData object.
        //
        Record records[] = encoder.getRecords();
        ConvertData cd = new ConvertData();
       
        PalmDocument palmDoc = new PalmDocument(docName,
            DocConstants.CREATOR_ID, DocConstants.TYPE_ID,
            0, PalmDB.PDB_HEADER_ATTR_BACKUP, records);

        cd.addDocument(palmDoc);
        return cd;
    }
View Full Code Here


            traverseBody(node);
        }

        // Get the number of sheets in the workbook
        // This will equal the number of PDBs we need
        ConvertData cd = new ConvertData();
        int numSheets = encoder.getNumberOfSheets();

        for (int i = 0; i < numSheets; i++) {

            // Get records for sheet i
            Record records[] = ((MinicalcEncoder) encoder).getRecords(i);

            // Get the sheet name for sheet i
            String fullSheetName = new String(docName
                                              + "-"
                                              + encoder.getSheetName(i));

            // Create a PalmDB object
            PalmDocument palmDoc = new PalmDocument(fullSheetName,
                 MinicalcConstants.CREATOR_ID,
                 MinicalcConstants.TYPE_ID, JMCconstants.AppVersion,
                 PalmDB.PDB_HEADER_ATTR_BACKUP, records);

            cd.addDocument(palmDoc);
        }


        // OutputStream os = new FileOutputStream(docName);
View Full Code Here

        // create a PalmDB object and ConvertData object.
        //
        Record records[] = encoder.getRecords();

        ConvertData cd = new ConvertData();
        PalmDocument palmDoc = new PalmDocument(docName,
            PdbUtil.intID("WrdS"), PdbUtil.intID("BDOC"), 0,
            PalmDB.PDB_HEADER_ATTR_BACKUP, records);
        cd.addDocument(palmDoc);
        return cd;
    }
View Full Code Here

          }
    }

        // Get the number of sheets in the workbook
        // This will equal the number of PDBs we need
        ConvertData cd = new ConvertData();
    Workbook wb = ((PocketExcelEncoder) encoder).getWorkbook();
    cd.addDocument(wb);

        return cd;
    }
View Full Code Here

            traverseBody(node);
        }

        // Get the number of sheets in the workbook
        // This will equal the number of PDBs we need
        ConvertData cd = new ConvertData();
        int numSheets = encoder.getNumberOfSheets();

        for (int i = 0; i < numSheets; i++) {

            // Get records for sheet i
            Record records[] = ((MinicalcEncoder) encoder).getRecords(i);

            // Get the sheet name for sheet i
            String fullSheetName = new String(docName
                                              + "-"
                                              + encoder.getSheetName(i));

            // Create a PalmDB object
            PalmDocument palmDoc = new PalmDocument(fullSheetName,
                 MinicalcConstants.CREATOR_ID,
                 MinicalcConstants.TYPE_ID, JMCconstants.AppVersion,
                 PalmDB.PDB_HEADER_ATTR_BACKUP, records);

            cd.addDocument(palmDoc);
        }


        // OutputStream os = new FileOutputStream(docName);
View Full Code Here

  String docName = sxwDoc.getName();
  org.w3c.dom.Document domDoc = sxwDoc.getContentDOM();
  org.w3c.dom.Document metaDoc = sxwDoc.getMetaDOM();
  org.w3c.dom.Document styleDoc = sxwDoc.getStyleDOM();
  ByteArrayOutputStream baos= new ByteArrayOutputStream();
         ConvertData cd = new ConvertData();
  Node offnode = (Node)domDoc.getDocumentElement();
  if (!(offnode.getNodeName()).equals("office:document")){
      try{
      DocumentBuilderFactory builderFactory = DocumentBuilderFactory.newInstance();
      DocumentBuilder builder= builderFactory.newDocumentBuilder();
      DOMImplementation domImpl = builder.getDOMImplementation();
      DocumentType docType =domImpl.createDocumentType("office:document","-//OpenOffice.org//DTD OfficeDocument 1.0//EN",null);
      org.w3c.dom.Document newDoc = domImpl.createDocument("http://openoffice.org/2000/office","office:document",docType);

     
      Element rootElement=newDoc.getDocumentElement();
      rootElement.setAttribute("xmlns:office","http://openoffice.org/2000/office");
      rootElement.setAttribute("xmlns:style","http://openoffice.org/2000/style" );
      rootElement.setAttribute("xmlns:text","http://openoffice.org/2000/text");
       rootElement.setAttribute("xmlns:table","http://openoffice.org/2000/table");

      rootElement.setAttribute("xmlns:draw","http://openoffice.org/2000/drawing");
      rootElement.setAttribute("xmlns:fo","http://www.w3.org/1999/XSL/Format" );
      rootElement.setAttribute("xmlns:xlink","http://www.w3.org/1999/xlink" );
      rootElement.setAttribute("xmlns:dc","http://purl.org/dc/elements/1.1/" );
      rootElement.setAttribute("xmlns:meta","http://openoffice.org/2000/meta" );
      rootElement.setAttribute("xmlns:number","http://openoffice.org/2000/datastyle" );
      rootElement.setAttribute("xmlns:svg","http://www.w3.org/2000/svg" );
      rootElement.setAttribute("xmlns:chart","http://openoffice.org/2000/chart" );
      rootElement.setAttribute("xmlns:dr3d","http://openoffice.org/2000/dr3d" );
      rootElement.setAttribute("xmlns:math","http://www.w3.org/1998/Math/MathML" );
      rootElement.setAttribute("xmlns:form","http://openoffice.org/2000/form" );
      rootElement.setAttribute("xmlns:script","http://openoffice.org/2000/script" );
      rootElement.setAttribute("xmlns:config","http://openoffice.org/2001/config" );
      rootElement.setAttribute("office:class","text" );
      rootElement.setAttribute("office:version","1.0");

      NodeList nodeList;
      Node tmpNode;
      Node rootNode = (Node)rootElement;
      if (metaDoc !=null){
    nodeList= metaDoc.getElementsByTagName(TAG_OFFICE_META);
    if (nodeList.getLength()>0){
        tmpNode = newDoc.importNode(nodeList.item(0),true);
        rootNode.appendChild(tmpNode);
    }
      } if (styleDoc !=null){
    nodeList= styleDoc.getElementsByTagName(TAG_OFFICE_STYLES);
    if (nodeList.getLength()>0){
        tmpNode = newDoc.importNode(nodeList.item(0),true);
        rootNode.appendChild(tmpNode);
    }
      }if (domDoc !=null){
    nodeList= domDoc.getElementsByTagName(TAG_OFFICE_AUTOMATIC_STYLES);
    if (nodeList.getLength()>0){
        tmpNode = newDoc.importNode(nodeList.item(0),true);
        rootNode.appendChild(tmpNode);
    }
    nodeList= domDoc.getElementsByTagName(TAG_OFFICE_BODY)
    if (nodeList.getLength()>0){
        tmpNode = newDoc.importNode(nodeList.item(0),true);
        rootNode.appendChild(tmpNode);
    }
      }
      domDoc=newDoc;
      }catch(Exception e){
    System.out.println("\nAn Exception occurred with Xslt Serializer"+e);
      }
    
  }
 
  try{
       baos=transform(domDoc);
  }
  catch (Exception e){
    System.out.println("\n Error with Xslt\n");
  }
 
  String ext = pluginFactory.getDeviceFileExtension()
        DOMDocument resultDomDoc=(DOMDocument)pluginFactory.createDeviceDocument(docName,new ByteArrayInputStream(baos.toByteArray()));
  cd.addDocument (resultDomDoc);
  return cd;
    }
View Full Code Here

        // create a PalmDB object and ConvertData object.
        //
        Record records[] = encoder.getRecords();

        ConvertData cd = new ConvertData();
        PalmDocument palmDoc = new PalmDocument(docName,
            PdbUtil.intID("WrdS"), PdbUtil.intID("BDOC"), 0,
            PalmDB.PDB_HEADER_ATTR_BACKUP, records);
        cd.addDocument(palmDoc);
        return cd;
    }
View Full Code Here

    public Document deserialize() throws IOException, ConvertException {

        int numberOfPDBs = cd.getNumDocuments();
        Document doc = null;
        int i=0;
        ConvertData cdOut;
        Enumeration e = cd.getDocumentEnumeration();
        while (e.hasMoreElements()) {
            PalmDocument palmDoc = (PalmDocument) e.nextElement();
            PalmDB pdb = palmDoc.getPdb();
View Full Code Here

        }

        // create a ConvertData object.
        //
        Record records[] = encoder.getRecords();
        ConvertData cd = new ConvertData();
       
        PalmDocument palmDoc = new PalmDocument(docName,
            DocConstants.CREATOR_ID, DocConstants.TYPE_ID,
            0, PalmDB.PDB_HEADER_ATTR_BACKUP, records);

        cd.addDocument(palmDoc);
        return cd;
    }
View Full Code Here

    public Document deserialize() throws IOException, ConvertException {

        int numberOfPDBs = cd.getNumDocuments();
        Document doc = null;
        int i=0;
        ConvertData cdOut;
        Enumeration e = cd.getDocumentEnumeration();
        while (e.hasMoreElements()) {
            PalmDocument palmDoc = (PalmDocument) e.nextElement();
            PalmDB pdb = palmDoc.getPdb();
View Full Code Here

TOP

Related Classes of org.openoffice.xmerge.ConvertData

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.