• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Landlord application

 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello everyone,

this is my first post here so please be patient.
I am beginner at writing java code, still much to do, but I know java basics.

I am trying to write my first, "serious" application. I would like to write a program which would allow me to put variables from my application into the callculation sheet made in Word.
I know that there is docx4j or ApachePOI which can do such things, but i find it little too hard for a beginner like me.

Is there any other way, maybe little easier to achieve my goal?
 
Rancher
Posts: 3742
16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Lukas Bec wrote:Is there any other way, maybe little easier to achieve my goal?


All the Microsoft Office formats are proprietary formats created by Microsoft and they're not that keen on giving other people access to them.
That's why libraries like docx4j and ApachePOI exist - they are the 'easy' way to do what you want to do.

I haven't actually used either of those libraries, but if you are finding them hard to use, then you might want to put off this application until you know a bit more about Java.
I hope I haven't discouraged you - that wasn't my intent.

Maybe if you explain why you think you need to use this calculation sheet made in Word, somebody may be able to suggest a better (easier) alternative.
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I think POI is not too hard to get into, but let's take a step back so you can explain a bit more what you intend to do. For example:

callculation sheet made in Word


This has me confused - Word is a text processor; calculations are made in a spreadsheet like Excel.
 
Lukas Bec
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for reply.

I poorly described what I would like to do. I need sheet which will only be a pattern, that I could use to put variables, like for example date, and people names, and their rent. I would like to have keywords in that sheet, and replace them with values from my variables.
I dont realy need that to be done in Word, but I would like to open that calculation sheet in some program, and print it or just watch it:).
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Still not sure, but perhaps you just want to create a PDF rather than a Word doc?
 
Lukas Bec
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Of course it can be PDF. I just wish to make one document, to be a pattern, and then use it im my application, to print my program results.
And please forgive me my english.
 
Ulf Dittmer
Rancher
Posts: 43081
77
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
OK, so you need a word processing template with variable substitution. I recommend to create the template in Word, and then to save it as RTF. RTF has the advantage of being text, so programmatic search-and-replace is comparatively easy.
 
Lukas Bec
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you very much. I will try do it that way.
 
Bear Bibeault
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Good call on the RTF, Ulf!
 
Bartender
Posts: 10780
71
Hibernate Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Lukas Bec wrote:Is there any other way, maybe little easier to achieve my goal?


I'm going to take a slightly different tack to my esteemed colleagues - don't bother with Office, spreadsheets, or RTF at all.

At least, not YET.

Presumably, this app has lots of other things to do than just create/update Office docs; so concentrate on that, and get that part (ie, the Java part) of it working, before you think about how you're going to save your data.

Others may disagree, but my worry with taking on something like POI - or even RTF - is that that is likely to take up all your energy, and distract you from your primary task, which is to get your application working.

And if you really need to save data? Just bash it out as plain text (or possibly java.util.Properties) for the moment.

HIH

Winston
 
Lukas Bec
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Everything you wrote Winston, is true.

I will leave this all RTF files stuff for now, because I use all my time to understand it, insetead of writing things that i can do in my application. But later I will try to understand and use a RTF template, to view results of my work, and try to print it. It is my goal.

Thank you all for advices.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic