Hello Dave,

Without being able to play with some code, and I am on the wrong machine for
that currently, I cannot say definitivly whether the API provides you with
that ability. However, there is a dodge that you could use if - and this is
the crucial bit - if you know what the column headings are going to be
before you build the workbook.

If you do know the column headings in advance, all you need to do is;

1. Open Excel.
2. Create a new blank workbook.
3. Set the column headings exactly as you want them.
4. Save the workbook away.

This is now a template that you will use to create your final file using
POI. So

5. Open that same file using POI.
6. Populate the worksheet(s).
7. Save the file away again under a different namw (maybe).

One of the decisions the designers of the api took was to preserve anything
they read in the file. So it ought to be the case that the column headings
you set will be preserved. Whilst I cannot guarantee this will happen - and
I cannot currently test if, sorry - I am confident that it will.

Yours

Mark B

PS Can you tell us which version of the file format you are targetting
please, the older binary format (.xls) or the newer OOXML\SpreadsheetML
format (.xlsx). The reason I ask is that it is also possible to post-process
the xml based files; you can unzip them and using a parser like SAX step
through the DOM and modify certain areas that POI may not currently touch.




Dave-53 wrote:
> 
> Hi, I got another question:
>  
> Is there a way to set column header names? Usually a sheet column header
> names are 
> A, B, C,D....
>  
> We like to set header names as ID, Name, Age, Grade,....
>  
> If the column header names can not be changed, how to add column header
> that can be anchored at the top? In other words,  the header row will not
> move during pageDown/up.
>  
> We could not find such API. Thanks for help.
>  
> Dave
> 
> 
> 
> 

-- 
View this message in context: 
http://old.nabble.com/How-to-set-column-header-names-tp28355185p28356493.html
Sent from the POI - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to