Creating an ODF document thru Java

How can i create a ODF text Document thru java ..

What kind of document you want to create? ODS, ODT ?
Do you need help on
http://www.jopendocument.org/start_text_2.html ?

Similar Messages

  • Creating Excel + word document i java

    Creating an MS Word+Excel Document in java
    I am doing a project in jbuilder an using a mysql db on a remote server what i want to do is to generate reports either in ms word an or ms excel after executing a query for example if I search for students aged 20+ I want to generate an excel sheet with all the records ....
    Does anyone knows how to do that or is there a good tutorial on the web that explains this issue
    Your help is appreciated many thanks...........

    First you should read the post about how to use these forums. Before you post it does not take much to see if your question has already been asked and answered. This question has appeared a few times in the last two days. It was asked and answered on this very forum only a couple of hours ago.
    Try here:
    http://jakarta.apache.org/poi/

  • How To Create MS-Word Document in JAVA ?

    I want to create a MS-Word Document using JAVA.
    then i want to create table in that document.
    is there any way through which i can create a Object of MS-Word in JAVA.

    As far as I know. There is no support. And you can't get the file format specification for MS Word documents.
    My advice is to look in to RTF, the spec is out there, although its not very nice.
    I think you can do tables in RTF, and you just need to write your output as text and MS word will load it.
    One thing to do is create a table in Word and save it as RTF, then look at the text and try to see whats going on. Although it won't be pretty !! Good luck

  • Problem while creating a custom document using JAVA API in the current Folder

    I am trying to create an instance of a custome type from the API. I have created a custom type via XML. I have associated a JSP with the custom type thru iFS manager. This jsp provides an interface for the user to enter various data. On submit I call some other jsp also loaded into the /ifs/webui/jsps which calls a method in the java class to create an instance of the above mentioned type. This instance needs to be created in the current directory and not in the home directory of the user. I have written a java program which when run from JDeveloper connects to the repository and creates the object, but not as a foldered object. If I load this class into custom_classes directory, I get an exception. I am attaching the code also here which does the actual processing.
    package cms;
    import oracle.ifs.agents.common.*;
    import oracle.ifs.agents.manager.*;
    import oracle.ifs.agents.server.*;
    import oracle.ifs.beans.*;
    import oracle.ifs.common.*;
    public class ContentModule extends Object {
    public static final String CLASSNAME = "CONTENT";
    public static final String TOPICID_ATTRIBUTE = "TOPICID";
    public static final String SITEID_ATTRIBUTE = "SITEID";
    LibrarySession m_session;
    public ContentModule() {
    connectToRepository();
    createDocument("AM5","s");
    public void connectToRepository(){
    try{
    LibraryService l_service=new LibraryService();
    CleartextCredential l_credential = new CleartextCredential("system","manager");
    ConnectOptions l_options=new ConnectOptions();
    l_options.setServiceName("IfsDefault");
    l_options.setServicePassword("ifssys");
    m_session=l_service.connect(l_credential,l_options);
    }catch(IfsException ex){
    ex.setVerboseMessage(true);
    ex.printStackTrace();
    public void createDocument(String p_docName,String p_docContent){
    try{
    DocumentDefinition l_doc=new DocumentDefinition(m_session);
    l_doc.setClassname(CLASSNAME);
    long newId1=5;
    long newId2=5;
    FolderPathResolver l_currentPath=new FolderPathResolver(m_session);
    Folder l_currentFolder=l_currentPath.getCurrentDirectory();
    l_doc.setAddToFolderOption(l_currentFolder);
    l_doc.setName(p_docName);
    l_doc.setContent(p_docContent);
    AttributeValue av1 = AttributeValue.newAttributeValue(newId1);
    l_doc.setAttribute(TOPICID_ATTRIBUTE,av1);
    AttributeValue av2 = AttributeValue.newAttributeValue(newId2);
    l_doc.setAttribute(SITEID_ATTRIBUTE,av2);
    Document l_document=(Document) m_session.createPublicObject(l_doc);
    }catch(IfsException ex){
    ex.setVerboseMessage(true);
    ex.printStackTrace();
    public static void main(String[] args) {
    ContentModule contentModule = new ContentModule();
    Any help will be highly appreciated.
    Thanks

    Please print out the Verbose Stack Trace generated when you run this application.
    I suspect that you FolderPathResolver is not pointed at the directory you think it is. You might want to try printing out
    I_CurrentFolder.getAnyFolderPath();
    and I_CurrentFolder.getName();
    null

  • Printing ODF documents thru eprint services

    I've set up my HP Photosmart 5510 with wireless eprint services, it works perfect when I send text files, PDF or Microsoft stuff (basicly, Word or Excel). When I try to send Open Office (*.odt) files, it just prints nothing.
    Is this format not supported (yet) or do I miss some piece of configuration in my printer?

    how do I print an attachment that contains an (*.odt) file  that contains text and photos.

  • Create Word document with Java

    I want to create a Word Document with Java. But I don't know how can I insert text in a Word document.

    I searched and found JXWord (probably limited to Windows): http://www.geocities.com/picmapicma/
    I'm interrested to know if it works fine...:)

  • How do I use java I/O to create a Ms_word Document

    If any body known, how to create a Ms-word Document from Java.

    You don't, Word has a VERY complicated file structure. You can make an interface for OLE to access Word and manipulate it that way or possibly purchase an object that someone has developed with MS's help.

  • Creating XML file in Project folder thru Java Program

    hi,
    i need one help. i need to create XML file in web://<Project Folder> in xmII thru Java Program. i created one java code and i am able to access XML file that is in c drive. i created jar file for this and placed as action block in Transaction and this working fine. but problem arises when i give file path in java code as web://<folder name>/file.xml which is in Web folder of project in xMII.
    How to access the file that is inside web folder from java code.
    regards
    senthil

    Hi Senthil,
    you can address the files that inside the MII workbench are viewed as "web://..." like this:
    http://<server>:<port>/XMII/CM/<Project>/<Folder>/<Filename>
    The workbench helps you find the correct filename:
    - open the WEB tab in the workbench
    - right-click on the filename
    - select "Copy Link" from the pop up
    Now you have the correct link in your clipboard.You can use the "web://" only inside MII.
    Michael

  • How to create XML document in Java from scratch ?

    I've downloaded the package generated for my schema.
    Now I'm trying to create a XML Document using the interfaces generated and the
    xmlbeans package. In documentation, all samples start with a call to XmlLoader.load(xmlinput).
    In my case I've no xmlinput, I've only java parameters and i need to produce an
    XML document.
    Could you provide a sample code please ?
    Thanks in advance.

    It looks like you only need to use the xmlText() method from the root of any node
    you want to print out to a file. I used a PrintStream() class and then used the
    ps.print(vpDetails.xmlText()); to save to a file.
    Hope this helps.
    Jerald
    "Eric Vasilik" <[email protected]> wrote:
    >
    To create a new, untyped document:
    XmlObject x = XmlLoader.newInstance();
    To create a new, typed document:
    Map options = new HashMap(
    XmlOptions.DOCUMENT_TYPE,
    CustomerDocument.type );
    CustomerDocument cd = (CustomerDocument) =
    XmlLoader.newInstance( options );
    I have changes pending which will alow you to do this more easily:
    CustomerDocument cd = CustomerDocument.Factory.newInstance();
    - Eric
    "Pascal Fuget" <[email protected]> wrote:
    I've downloaded the package generated for my schema.
    Now I'm trying to create a XML Document using the interfaces generated
    and the
    xmlbeans package. In documentation, all samples start with a call to
    XmlLoader.load(xmlinput).
    In my case I've no xmlinput, I've only java parameters and i need to
    produce an
    XML document.
    Could you provide a sample code please ?
    Thanks in advance.

  • Create ODF document using ABAP ?

    There any way to create ODF documents (Text/Spreadsheet) using ABAP + http://opendocument.xml.org standards ?
    Tks,
    Cleber

    There any way to create ODF documents (Text/Spreadsheet) using ABAP + http://opendocument.xml.org standards ?
    Tks,
    Cleber

  • ClassCastException while creating an XML document in servlet

    HI,
    I am trying to create an XML document in a servlet and I am getting ClassCastException at runtime when casting org.w3c.dom.document to org.apache.crimson.tree.XmlDocument . I am using Tomcat 4.1
    The same code is working fine when executed in a stand alone java program
    Can anyone please help me in trying to solve this problem. I require it urgently.
    The following is my code:
    import java.io.*;
    import javax.xml.parsers.*;
    import org.w3c.dom.*;
    import org.apache.crimson.tree.XmlDocument;
    public class test{
    public void createxml (String username) throws Exception
              Document doc=null;
              DocumentBuilderFactory dbf=null;
         DocumentBuilder db=null;
         Element root=null;
         Element poline=null;
         org.apache.crimson.tree.XmlDocument xmldoc=null;
         FileOutputStream fos=null;
         dbf = DocumentBuilderFactory.newInstance ();
              db = dbf.newDocumentBuilder ();
              doc = db.newDocument ();
              root = doc.createElement ("album");
              doc.appendChild (root);
              poline= doc.createElement("album-name");
              root.appendChild(poline);
    //I am getting the ClassCastException in this statement
              xmldoc = (XmlDocument) doc;
              fos = new java.io.FileOutputStream("xyz.xml");
              xmldoc.write(fos);
              fos.close();
    }

    I am not too much of an expert on this issue, but I did a search. Maybe this page can help or point you in the right direction.
    http://www.jspwiki.org/Wiki.jsp?page=A2AClassCastException
    I hope this helps.

  • Problem in printing pdf document with java code

    Hi All
    I want to print a pdf document with java code i have used PDFRenderer.jar to compile my code.
    Code:
    File f = new File("C:/Documents and Settings/123/Desktop/1241422767.pdf");
    FileInputStream fis = new FileInputStream(f);
    FileChannel fc = fis.getChannel();
    ByteBuffer bb = fc.map(FileChannel.MapMode.READ_ONLY, 0, fc.size());
    PDFFile pdfFile = new PDFFile(bb); // Create PDF Print Page
    PDFPrintPage pages = new PDFPrintPage(pdfFile);
    // Create Print Job
    PrinterJob pjob = PrinterJob.getPrinterJob();
    PageFormat pf = PrinterJob.getPrinterJob().defaultPage();
    pjob.setJobName(f.getName());
    Book book = new Book();
    book.append(pages, pf, pdfFile.getNumPages());
    pjob.setPageable(book);
    // System.out.println(pjob.getPrintService());
    // Send print job to default printer
    pjob.print();
    but when i am running my program i am getting error
    Exception in thread "main" java.awt.print.PrinterException: Invalid name of PrintService.
    Please anybody, knows the solution for this error?
    Thanks In Advance
    Indira

    It seems that either there is no default printer setup or you have too many printers or no printer setup at all. Try running the following code. It should print the list of available print services.
    import java.awt.print.*;
    import javax.print.*;
    public class PrintServiceNames{
         public static void main(String args[]) throws Exception {
              PrintService[] printServices = PrinterJob.lookupPrintServices();
              int i;
              for (i = 0; i < printServices.length; i++) {
                   System.out.println("P: " + printServices);
    }From the list pick one of the print service names and set it explicitly like "printerJob.setPrintService(printServices);" and then try running the program.

  • Create .xml file from a java file

    I wanted to know how can we create a .xml file through java with the given data.
    For example: book saler.
    data given through java are
    1)Sl no
    2)Book name
    3Book type
    4)Book price
    i want a xml file generated through the java code
    can anyone help me out?

    i have done like this..
    but the problem with this is i want to add more than one book details. i am able to add only one book detais..
    package name:createxml
    main class:GenerateOrderXml.java
    CreateXml.java and order.java
    package createxml;
    import java.util.Vector;
    public class GenerateOrderXml {
         public static void main(String[] args) {
              try{
              Order order= new Order();
              CreateXml xml=new CreateXml();
              Vector orders=new Vector();
              order.setBookName("Java_for_beginers");
              order.setAuthorName("Balaguruswamy");
              order.setISBN("a123");
              order.setNo_of_copies("3");
              order.setprice("350");
              order.setPublisher("Deepak publishers");
              orders.add(0,order);
              order.setBookName("Java");
              order.setAuthorName("Bala");
              order.setISBN("a123");
              order.setNo_of_copies("3");
              order.setprice("350");
              order.setPublisher("Deepak ");
              orders.add(1,order);
              xml.creatxml(orders);
              catch(ArrayIndexOutOfBoundsException e)
                   e.printStackTrace();
    package createxml;
    import org.jdom.*;
    import org.jdom.output.XMLOutputter;
    import java.io.IOException;
    import java.util.Vector;
    * @author divyashree
    * To change the template for this generated type comment go to
    * Window - Preferences - Java - Code Generation - Code and Comments
    public class CreateXml {
         public void creatxml(Vector orders)
         try
                   Element root = new Element("BookSaler");          
                   Order order= new Order();          
                   order=(Order)orders.elementAt(0);
                   Element BName = new Element("Bookname1");
                   BName.setText(order.getBookName());
                   root.addContent(BName);
                   Element AName = new Element("Authorname");
                   AName.setText(order.getAuthorName());
                   BName.addContent(AName);
                   Element isbn = new Element("ISBN");
                   isbn.setText(order.getISBN());
                   BName.addContent(isbn);
                   Element price = new Element("Price");
                   price.setText(order.getprice());
                   BName.addContent(price);
                   Element publisher= new Element("Publisher");
                   publisher.setText(order.getPublisher());
                   BName.addContent(publisher);
                   order=(Order)orders.elementAt(1);
                   Element BName1 = new Element("Bookname2");
              BName1.setText(order.getBookName());
              root.addContent(BName1);
              Element AName1 = new Element("Authorname");
              BName1.addContent(AName);
              Element isbn1 = new Element("ISBN");
              isbn.setText(order.getISBN());
              Element price1 = new Element("Price");
              BName1.addContent(price);
              Element publisher1= new Element("Publisher");
              BName1.addContent(publisher);
              Document doc = new Document(root);
              try {
                   XMLOutputter serializer = new XMLOutputter();
                   serializer.setIndent(" ");
                   serializer.setNewlines(true);
                   serializer.output(doc, System.out);
              catch (IOException e)
                   System.err.println(e);
         }catch(ClassCastException e)
              e.printStackTrace();
    package createxml;
    import java.util.Vector;
    public class Order {
         protected String ISBN="";
         protected String BookName="";
         protected String AuthorName="";
         protected String No_of_copies;
         protected String price;
         protected String Publisher="";
         public String getISBN()
              return this.ISBN;
         public String getBookName()
              return BookName;
         public String getAuthorName()
              return AuthorName;
         public String getNo_of_copies()
              return No_of_copies;
         public String getprice()
              return price;
         public String getPublisher()
              return Publisher;
         public void setISBN(String isbn)
              Vector vec_isbn= new Vector();
              ISBN=isbn;
         public void setBookName(String bookname)
              BookName=bookname;
         public void setAuthorName(String authorname)
              AuthorName=authorname;
         public void setNo_of_copies(String no_of_copies)
              No_of_copies=no_of_copies;
         public void setprice(String Price)
              price=Price;
         public void setPublisher(String publisher)
              Publisher=publisher;
    /***************************************************************************/

  • How to create an XML document from a String.

    Can anyone help,
         In the Microsoft XML Document DOM there is a load function load(string) which will create an XML document, but now we are switching to Java and I do not know how to create and XML document from a string, this string �xml document� is passed to my program from a webservice and I need to read several xml elements form it in a web server.
    This string is a well formatted XML document:
    <?xml version="1.0" encoding="UTF-8"?>
    <Countries NumberOfRecords="1" LanguageID="en-us">
         <Country>
              <CountryCode>AU</CountryCode>
              <CountryName>AUSTRALIA</CountryName>
         </Country>
    </Countries>

    Thanks PC!
    I made it work using:
    DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
    DocumentBuilder builder = factory.newDocumentBuilder();
    factory.setIgnoringComments(true); // We want to ignore comments
    // Now use the factory to create a DOM parser
    DocumentBuilder parser = factory.newDocumentBuilder();
    //TransformThisStringBuffer is a string buffer wich contain the 'XML document (String)'
    InputStream in = new ByteArrayInputStream(TransformThisStringBuffer.toString().getBytes());
    // Parse the InputStream and build the document
    Document document = parser.parse(in);
    But which one is faster InputSource or InputStream, were would you put the "new InputSource(new StringReader(yourString))" in the above code?

  • How do I save a xls document in Java

    Hi!
    How do I save a xls Document from java?
    I mean, I want to specify which xls document to save and then save it.
    Any useful code would be of great help!

    This is the code!
    import java.io.*;
    import java.io.File;
    import java.io.FileInputStream;
    import java.io.FileOutputStream;
    import java.util.Locale;
    import jxl.Workbook;
    import jxl.WorkbookSettings;
    import jxl.write.Label;
    import jxl.write.WritableCell;
    import jxl.write.WritableCellFormat;
    import jxl.write.WritableImage;
    import jxl.write.WritableSheet;
    import jxl.write.WritableWorkbook;
    import jxl.write.Number;
    import jxl.write.*;
    import java.io.IOException;
    import java.io.OutputStream;
      public class writeXls
            public String templateName;
            public String outputName;
          public writeXls (String t, String o)
             templateName = "c://"+t;
             outputName = "c://"+o;
          public void writeYearVolume(String []yearvolymeArray)
              WritableWorkbook workbook = null;
              try
                  // Setup workbook
                  WorkbookSettings ws = new WorkbookSettings();
                  ws.setLocale(Locale.UK);
                  ws.setEncoding("Windows-31J");
                  // Load workbook
                  Workbook template = Workbook.getWorkbook(new FileInputStream(templateName));
                  // Create new workbook
                  workbook = Workbook.createWorkbook(new FileOutputStream(outputName), template, ws);
                  // Create new sheet
                  WritableSheet sheet = workbook.getSheet(1);
                  // Create new label
                  Number amc1000= new Number(4, 1, Integer.parseInt(yearvolymeArray[0]));
                  Number amc800 = new Number(4, 2, Integer.parseInt(yearvolymeArray[1]));
                  sheet.addCell(amc1000);
                  sheet.addCell(amc800);
                  // Write wookbook
                  workbook.write();
                  workbook.close();
                catch (IOException e)
                  e.printStackTrace();
                catch (WriteException e)
                  e.printStackTrace();
                catch(Exception e)
                    e.printStackTrace();
      }The xls file is modified but not saved, how do I save the file?
    Some of the cells in the xls file contains formulas, because of that, the cells containing formulas dosen't update its value.
    if I however save the file manually then the cells are updated. I want to save the xls file automatically from Java.
    Any ideas on how to do that?

Maybe you are looking for

  • How to get Safari printing images in proper resolution?

    I have problems printing high resolution images from a web page. Example: When printing a 300 dpi image that measures 5 x 6 inches Safari rescales this image to a resolution of about 282 dpi which results in a slightly larger image. The web page cont

  • Viewing a CMYK PDFX1/A PDF on an iPad and holding the color?

    Hello, Ok, here is an odd one... We have a vendor where we need to supply a PDFX1/A 4/c PDF for the iPad version. When I view it on the iPad, it looks terrible...gets very bright, the colors aren't even close. If I export the same InDesign file as an

  • Scheduling Process chain

    Hi, Please throw some light to this issue... We had scheduled one process chain from R/3 by going to sm37 and repeat scheduling the process chain. when i repeat it showing repeat shceduling pc is getting failed. Regards dyuthi

  • Restore datafile from an OS copy

    Hi all, I have a 10GR1 database open with datafiles marked as MISSING in the dictionnary. I have an OS copy oh those datafiles. These datafiles are contained in a Read Only tablespace. Could you explain me how can i recover this datafile to the datab

  • Call List

    Hi All, In CRMD_CALL_LIST, can we use "USE PROFILE" to assign agent group to customer group from target list for outbound call? Thanks in advance. Krish