Hi Hieu,

Look at "Busy developer 's guide" here 
http://poi.apache.org/spreadsheet/quick-guide.html#NewWorkbook. Using 
inheritance or abstract classes/interface I would say is the right way instead 
of utility class. Why? Because every time you create an excel file, modify and 
save it, thus follow OO way.

regards,
murod




________________________________
From: Hieu Dang Duy <[email protected]>
To: Murodullo Latifov <[email protected]>; Dhis2 
<[email protected]>
Sent: Friday, July 17, 2009 8:16:56 PM
Subject: Fwd: JXL with POI

Dear Murod,

It is joyful when received your reply mail.

So behind in this mail, I've got some wonders to worry to ask you:

How can we do if none of using a template instead-of a scratch file ?
By the way, I shall focus on your suggestion about the inheritance. It's really 
helpful for me to get a next important step to working on POI.
But, I'm still misunderstanding or can say that it's a vague thing of mine 
about this. Why should be have done as an Interface or Abstract class ? Is that 
right your meaning ? Why not as a utilizable class file which I sent to you 
before ?

Thank you !

p.s: Also forward to the mailing list.



---------- Forwarded message ----------
From: Murodullo Latifov <[email protected]>
Date: Fri, Jul 17, 2009 at 3:35 PM
Subject: Re: JXL with POI
To: Hieu Dang Duy <[email protected]>



Hi Hieu,

Good to hear you managed to solve your problems. You can place or remove format 
stuff as you wish. The idea behind having formats is to have ability to create 
excel from scratch, that means not having any template, creating new excel 
file, adding formats, sizing you columns, etc. Main point is to unify most and 
frequent used methods in a separate file and inherit from it and not to type it 
all the time, which is general in object oriented programming. I suggest you to 
have a java class with all formats and common methods, like your writeValue() 
and create other specific implementations inheriting from it, this way you will 
have clear code, and overwrite when needed. 
It would be good if you use mailing list, so others may sometimes use solution, 
and find out how did it work.

Good luck,
murod




________________________________
From: Hieu Dang Duy <[email protected]>
To: Murodullo Latifov <[email protected]>
Sent: Wednesday, July 15, 2009 3:05:30 PM
Subject: JXL with POI


Dear Murod,

Finally, I've solved the issue of recalculating value by POI's Formula 
Evaluation (JXL combines with POI - so excited)

So, really thanks to your help !

Until now, a quite small problem is that I wanna replace the way of writing on 
Excel file from JXL to POI.
But I'm not good at POI technique. So, can I ask you some questions such as:

What should I have done if using POI to replace JXL to write on excel file, for 
example:

- Any important formats (Font, Number, String, Formula, etc...) ?
- Any main points which must be pay attention to ?

In your project POI that you sent to me. I see that you'd declared so many 
formats :


        HSSFFont csf = hssfworkbook.createFont();
        HSSFFont csfBold = hssfworkbook.createFont();
        HSSFDataFormat df = hssfworkbook.createDataFormat();
        HSSFCellStyle cs = hssfworkbook.createCellStyle();
        HSSFCellStyle csHeader = hssfworkbook.createCellStyle();
        HSSFCellStyle csSize = hssfworkbook.createCellStyle();
        HSSFCellStyle csCurrency = hssfworkbook.createCellStyle();
        HSSFCellStyle csSizeBold = hssfworkbook.createCellStyle();
        HSSFCellStyle csCurrencyBold = hssfworkbook.createCellStyle();
        HSSFCellStyle csPercentage = hssfworkbook.createCellStyle();
        HSSFCellStyle csNormal = hssfworkbook.createCellStyle();
        HSSFCellStyle csNormalOdd = hssfworkbook.createCellStyle();
        HSSFCellStyle csCurrencyOdd = hssfworkbook.createCellStyle();
        HSSFCellStyle csPercentageOdd = hssfworkbook.createCellStyle();
        HSSFCellStyle csSizeOdd = hssfworkbook.createCellStyle();
        HSSFCellStyle csCountOdd = hssfworkbook.createCellStyle();
        HSSFCellStyle csCount = hssfworkbook.createCellStyle();

If I leave these formats above in my source code so what will be happened ?
I shall send to you a file "ExcelUtil.java". Can you take a look at this one. 
And please give me some of suggestions.

THANK SO MUCH !

-- 
Hieu.HISPVietnam
Good Health !




-- 
Hieu.HISPVietnam
Good Health !



      
_______________________________________________
Mailing list: https://launchpad.net/~dhis2-devs
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~dhis2-devs
More help   : https://help.launchpad.net/ListHelp

Reply via email to