Wednesday 15 August 2012

java - saving to .doc file table -


Is it possible to save some text and values ​​in a DOC file and put it in a table inside that doctor file? I have a shopping list with a column for the product name, one for the price and one for the price I am currently using it to save my files, but they are all messy, they combine (Most product names, quantities, and price text variables vary in anchors), so I have a good way of making them a desk to ensure that they are well organized Ia is.

Or is there a way to format my text, put them on the columns? I hope you understand what I mean, if not, then let me know.

  file root = android.os.Environment.getExternalStorageDirectory (); File directory = new file (root.etabolite path (+ + "/ interSRL"); Dir.mkdirs (); File file = new file (dir, "myData.doc"); {FileOutputStream f = Try New FileOutputStream (File); PrintWriter PW = new printrover (F); (Int n = 0; n & lt; allpret.size () - 1; n ++) {if (cant [n]! = Float.toString (0) & amp; amp; amp; ;; am [n]! = Float.toString (0)) {string mariformat = "% -10s% -10s% -10s% n"; Pw.println (String.format (myFormat, prod [n], cant [n], pret [n])); }} Pw.println ((String.format ("Total:% .2f", Kulatestez))); Pw.flush (); Pw.close (); F.close (); } Hold (FileNotFoundException e) {e.printStackTrace (); Logs. I (TAG, "******* File not found. Did you add the WRITE_EXTERNAL_STORAGE permission for the merchant?"); } Hold (IOException e) {e.printStackTrace (); }    

You can do this with Apache POI . Have a look.

In short, you can read and write MS Excel files using Java. In addition, you can read and read MS Word and MS PowerPoint files using Java. Apache POI is your Java Excel solution (for Excel 97-2008) We have a complete API to port other OOXML and OLE2 formats and welcome others to participate.

To handle Microsoft word files is the Java API Hope it helps.

No comments:

Post a Comment