Is there a definitive method of creating either a PDF or a MS Word Doc file within the app and email it immediately (and possibly, also store it).
I have been trying for quite some time and have found out the JAVA libraries: apwlibrary and iText. But both of them dont provide any tutorials of sorts.
Could anyone point me in the right direction?
EDIT: Come to think of it, is could an online PDF generator be used, first by sending the data to the service, then retrieve the result and save it on the phone?
I would recommend apache fop http://xmlgraphics.apache.org/fop/
you can use standard FOP to generate pdf.
Unless it is a core feature of your device to create a pdf file I would suggest not to do it yourself. Adding PDF creation is going to be quite a lot of work potentially depending on your performance needs. Java libraries will be easier to add but less performant. Native libraries combined with Java will be more hazzle to maintain build and bug fixing wise.
If you just need to email some information why dont you create a message text in html and use a intent to email it with the build in email program instead? Or if you want you could e.g. put the PDF generation on a server and just email a link..
I'm working right now with JasperReports, an open source library to create reports in Java and export them to PDF, DOC, XLS... Using it in conjunction with iReport to create a group of templates makes it really easy to create files filled with content from different types of sources (I'm using JavaBeans).
If you don't like the idea of having static templates (That's a bit annoying depending on your needs), you can always take a look at DynamicJasper (The examples on the website are great).
Good Luck!
I have used Apache POI. It seemed to work well. http://poi.apache.org/
This actually, http://poi.apache.org/hwpf/
Related
My app is going to be translated by several amateur translators for several languages. I can send them the xml file with all the strings that need to be translated. But, is there a cleaner way to have two files uploaded, the one in English and the one to be translated, to easily identify the strings that are still missing? Basically is like having the Translation Editor of Android Studio but online.
Maybe using google docs? How do you do this?
You can use Google Docs, but that's quite an outdated way to handle this.
The major cons:
it would be cumbersome to update strings this way
no easy way to make sure the new ones have new translations, not the old ones, etc.
no good way to provide context, if needed (typically translators have questions). You can create a column with context and take any discussions into comments, but it can get messy
A few pros:
it's fast to create (although slow to keep up-to-date)
you cooperate online and have shared access
Most developers use localization platforms, which makes updating content and online cooperation much faster.
Main pros:
it's easy to identify strings that are missing
any number of translators can translate simultaneously
track work that is done by each of translators
you can add a review/proofreading step to the process to ensure the quality of translations
leverage Machine Translations and then just have translators review them (saves lots of time)
update content, as most platforms support agile workflow
you can see who's the top translator (give some rewards, invite to other projects, etc.)
integrations (with your Git tool, Android Studio, etc), so you can automate content updates, no manual copy-pasting
Cons:
some of them are paid (still, if you're open source, you can expect a free plan)
Regarding the tools, I can suggest looking at Crowdin or Poedit.
There are many alternatives you can research, some are listed on Wikipedia.
At my work we had to translate english into Norwegian, we've done that by working with an python script that generated an ui from an csv file, after that the file could be exported in several formates as well. But your question indicates that you would like to deploy only on android, so this might be an overkill.
a simple python xml filter would fit your aproach and you could work as well with git as long as the lines stays in the same order.
if you need an quick example please comment, and ill edit this answer as soon as i get time.
At one point I have also had the same question. I need the translation for my vernacular app, also I had the requirement to maintain such that I could easily compare the translation. Here I could suggest a few things that worked out for me.
First, take the string XML file and convert it in an Excel sheet, You may generate multiple excel sheet and having a copy, paste and merge all the translations into a single sheet.
Going forward it will be easy for you to maintain all the translation. Just share a single sheet which has a string key and multiple language column. So you could easily have a look at all language translations.
In the long run, it will be helpful to you.
Few links for the conversion of XML to excel -
Convert string XML to Excel sheet
Using the below online tool works for me. Free and Opensource easy and best.
https://asrt.gluege.boerde.de/
I need to convert this PDF into a spreadsheet that looks something like THIS. But when I copy and paste all the text from the PDF (CTRL+A), the layers are in some weird unpredictable order and looks like THIS.
Is there anyway to copy and paste the text in some kind of predictable way so I can turn it into the spreadsheet I linked to? (I should mention that I'm making an android app, so id prefer the solution to be inside an Android Studio Project, but that might not be necessary)
Any suggestions are appreciated, thanks.
I want to create a word document within an android app and send that document through mail.
Is there any tutorial for creating a word document in android. I have gone through several other questions on this website but i didn't got a clear answer.
can we do this on Android using Apache POI.
If any any sample example exist then please mention.
Thanks in advance.
You can use any Java library in Android, so I do think this would be the way you could accomplish what you want (using Apache POI).
You can send the attachment by adding it as an extra to the Intent you use to create a mail message (lots of examples of that).
Apache POI looks your best bet, but note that the component that deals with Word docs only supports simple files:
HWPF and XWPF for Word Documents
HWPF is our port of the Microsoft Word 97 (-2003) file format to pure Java. It supports read, and limited write capabilities. It also provides simple text extraction support for the older Word 6 and Word 95 formats. Please see the HWPF project page for more information. This component remains in early stages of development. It can already read and write simple files.
We are also working on the XWPF for the WordprocessingML (2007+) format from the OOXML specification. This provides read and write support for simpler files, along with text extraction capabilities.
You should seriously consider whether you can use a different format for your emails - plain text, or maybe HTML.
I am new to Android development and would like some advice from some more experience developers.
The app I am developing is effectively a form for servicing products (i.e. does x work, does y work etc.. ). Once the form has been completed a "report" of some kind needs to be generated in a non-editable format! Initially I was thinking to display a confirmation page and when confirmed by the user simply screenshot the report, however I realise this is a hacky solution and would be rather limiting! So basically I would like some input on what options I have to implement such a feature! To be clear the output file MUST be non-editable... i.e. an image file or pdf!
Also FYI - the report file will be uploaded to a dropbox/a specified folder.
PDF files seem to be a good solution for you. I would rather create a Web Service to deliver the pdf, because some devices will be really slow creating a pdf, but if you decide to take a client approach, take a look at:
http://code.google.com/p/droidtext/
http://sourceforge.net/p/itext/code/5420/tree/tags/iText_2_1_7
Can anyone recommend a good source (either a tutorial or book?) on how to generate a .doc file from an Android App?
I am completely new to programming and don/t understand most of what I read as answers here, hence the need for a recommendation: I need to learn!
What I'm after is to be able to produce a document based on a standard template, containing a choice of standard paragraphs with user insertions, which can then be emailed, all from a smart phone or tablet.
Unfortunately I think you have a research task on your hands. If your requirements allow you to create an Open Office XML document then its possible to insert the user's paragraphs 'by hand'.
An Open Office XML document is just a zip archive with XML files inside of it. Unzip the template document using java.util.zip and locate the word/document.xml file inside. Insert the user's text using the DOM and persist the file.
Another approach would be to try to get docx4j integrated into your Android project. My guess is that this project reference many libraries that are not included with the Android SDK.
Good luck and hope this helps.