A real estate agent asked me to create a program to automate the process of generating rental agreement contracts. Basically the whole document is the same for most parties but only a couple of lines change (date, addresses, social security numbers, names, etc.).
Ideally they'd fill out a form with that information, press a button and then the contract is automatically generated.
I've worked with a few java libraries to create excel documents in the past but I was wondering what would be the best approach to create something like this? Probably doing a java GUI with the form to then export into word might be an overkill (considering that it needs to follow a template design with logos, specific fonts and size)? Or would programming a plugin for Word in VBA or C# be able to do the trick? Or maybe there is a simpler way that I haven't thought of yet.
Thanks again for you input!
Mail merge? That's what i think first and foremost.
You can also use macro from other .doc processing software and use the macro like OpenOffice.
Reference.
We developed our own library and recently published it at GitHub: https://github.com/wte4j/wte4j. We are using word documents with content controls as templates. Feel free to have a look at it.
You can use AceOffix to do this.
Make the rental agreement contract template. insert bookmarks (such as: date, address, social security number, name, etc.) in template
Call the method OpenDataRegion ("BookmarkName").Value= "XXXXXXX", to assign value to the bookmarks in the contract template
Note: AceOffix opens Word files in the client browser for online processing, so MS Office must be installed on the client computer.
Related
I want to write a word search,which connects to a specific website(huge one),takes the word from user,searches the site and returns the strings which contain the word;this should be written in java and as an applet.I have read some tutorials and questions on this,and understood what have to be done is:
1.connect to a website and get the content of a website and save it to a string.(this should be done with a webcrawler which will be made from my own code for connecting to website and save the content to a string + jsoup library to parse the html code).
2.save the datas to a database(in my case nosql database).
3.index the datas in database.
4.query the database to show the results.
5.make a UI for showing the search results(I use swing.japplet).
now my qustions are:
1.have I understood correctly the steps which I have to go?(please explain me in details if a step is unnecessary or necessary)
2.Is it necessary to have a database?
notice:I want to implement it myself,without using ready things such as lucene,nutch,solr,...
edit:3 people told me applet is not suitable for such a thing,so what should be the replacement?
many many thanks for your help.
You should look at using Lucene, as it does most of what you want here.
You should not use applets.
For small data set, database should be sufficient. Databases like mysql comes with full text search functions.
For bigger data set, you might want to consider Lucene or Solr.
That is one way way to implement this. Another (simpler) way would be to use an existing text search / indexing engine like Lucene / Solr. Going to the effort of reimplementing the "text search / indexing" wheel using database technology strikes me as a waste of effort, unless you have a sound technical reason for doing so.
You do need to has some kind of database, because indexing a website on the fly would simply not work. Lucene will handle that.
I think your choice of Java applets to build the UI is a bad idea. There are other technologies that give results that are as good or better ... without the security risk of a Java browser plugin.
Finally, another way to make your website searchable is to get Google to do it for you. Make your website content indexable, and then use Google's search APIs.
I have a application which is created on ZK Framework , i want to give user a functionality where user can open a saved file in edit mode and then again saved the changed in database can any one know which API can help me to do this?
You could use Google Apps to do so and set Google Docs to edit your DOC, PDF or even XLS extension files. For more help on setting it up, feel free to ask again. :)
The problem you're posing doesn't have a simple answer, unfortunately.
There are two general approaches you could take..
The low hanging fruit is to provide an interface for the user to download a file and upload it after they make edits using whichever editing software they choose / is appropriate.
The other approach would be to provide a GUI to edit files. Regardless of the web framework you are using, this is a daunting task to say the least. As #userRandom mentioned, this is a large part of what Google Drive (formerly Google Docs) is attempting to solve.. but even Google's solution is not perfect and very much a work in progress.
I would strongly suggest evaluating the scope of your project before proceeding.
If you choose to move forward, consider a simple solution that works for .txt files. Then, consider how you might handle .doc files. Then, PDF files, XLS files, etc.
Folks here will be able to answer specific questions.
I want to develop a Java desktop application. This appliation will generate word documents about patients. There will be some fixed and variable fields, columns at some templates.
System will be like that: I will keep the patients information(these are variables) There will be some messages, question at different templates(fixed variables) Patients will answer the questions and they will be stored too. After patients answer questions, give their information, appliation will generate form/s(this forms has fixed alignments, borders etc.) Patients will give their photos too and they will be stored at database.
System users will be able to print it and will have an ability to search documents, user, etc..
I will ask you how to develop that application, I mean how to keep templates, write the information to the form at correct places, organise a better database, organise photos etc.
I am open for other advises too about developing program(database side, Java desktop application side, better gui advices etc.)
I don't really see what your question has to do with database design. If you will be creating Word documents using the client application on the desktop the data should probably be available from there (at least during creation of the Word document). That the data is also stored on the server is not relevant (for the Word document).
There is already a question about Word and Java, so you could read that for some information.
If however you decide to generate your Word (POI, via OpenOffice, COM interface) you will probably want to get the template, images and other data from the server to the client computer just before creating the Word file (and delete it afterwards), or let the server create the Word file.
As an alternative I suggest you look at the RTF format. Rich Text Format is supported by Word, can have images, and is more easy to handle (Java has a Standard RTF editor kit included, I don't know how good it is).
I'd like to store then later display user-entered content securely with minimal effort (my goal is a web app not writing a bunch of security-related code).
EDIT: Google App Engine for Java
I'm working with the same issue myself; but I haven't had the chance to get it out into the real world yet; so please just keep in mind that MY ANSWER IS NOT BATTLE TESTED. USE AT YOUR OWN RISK.
First, you need to ask yourself if you're going to be allowing the user to use ANY html markup. So, for example, can the user enter a link? What about make bold text?
If the answer is NO, then it is fairly simple. Here is the idea of how to set the filter up:
http://greatwebguy.com/programming/java/simple-cross-site-scripting-xss-servlet-filter/
But personally, I don't like the filter being used in the first example; I just put it there to show you how to set the filter up.
I would recommend using this filter:
http://xss-html-filter.sourceforge.net/
So basically:
Setup the example from first link, get it working
Download the example from the second link, put it in your project in such a way you can access it from your code.
Rewrite the cleanXSS method to use what you downloaded from the second link. So probably something like:
private String cleanXSS(String value) {
return new HTMLInputFilter().filter( input );
}
If you do want to allow HTML (such as an anchor tag/etc) then it looks like the HTMLInputFilter has mechanisms to allow this; but it isn't documented so you'll have to figure it out by looking at the code yourself or provide your own way of filtering.
user-entered content securely with minimal effort (my goal is a web app not writing a bunch of security-related code).
How much security-related code you need to write depends on how much you are at risk (how likely is it someone would want to attack your site, which it self is related to how popular your site is).
For example if your writing a public notepad, which will have a total of 3 users, you can get away with the bare minimum, if however your writing a we hate China, Iran and all hackers/crackers app dealing with $1,000,000 worth of transactions an hour and 3 billion users, you may be a bit more of a target.
Simply put you shouldn't trust any data that comes from outside your app including from the datastore. All this data should be checked that it's what you expect.
I've not validated incoming Java Strings against XSS however removing HTML is normally good enough, and Jsoup looks interesting for this (See Remove HTML tags from a String )
Also to be sure you should ensure your outputting what you expect to be outputting and not the some JavaScript.
Most templating engines, including django's (which is bundled with App Engine), provide facilities to escape output to make it safe to print in HTML. In newer versions of Django, this is done automatically unless you tell it not to; in 0.9.6 (still the default in webapp), you pass your output values to |escape in the template.
Escaping on output is universally the best way to do this, because it means you have the original unmodified text; if you modify your escaping or output formatting later, you can still format text entered before that.
You can also use a service that will proxy all connections and block any XSS attempts. I know only one service like that - CloudFlare (but it doesn't mean there aren't others like that). Unfortunately security features goes in with Pro plan which is paid :(
Has anyone got a working solution without some Java/COM-bridge? E.g. process the Email as a file (.msg) rather than locating the data that is referenced in the Clipboard?
Maybe this is a solution for your problem:
http://sourceforge.net/projects/javaoutlookdd/
It allows to handle outlook items like File objects during drag&drop.
I did make some headway on this sort of thing a few years back using Apache POI to extract the contents of an email from .msg files. I'm pretty sure they have a simple swing explorer / viewer that you can use to examine the structure within the compound document format, but I can't find it right now.
I was able to extract most information that I was interested in but was ultimately wanting to create a mime format version of the message and couldn't extract all the information I needed in a format I could use.
I assume that you've already ruled out the tools in "org.eclipse.swt.dnd" for some reason? There are some examples here on how to go about using them, in case you haven't. If what you really want to do is drag&drop, you're going to have to do some work with those tools. At that point, really the question becomes, what format is it in on the clipboard, vs in a file, and which is easier to integrate into your app.