|
On Fri, 19 Nov 2004, Smith, Mike wrote: > I have created a CSV file and this particular record looks > like"0006075", but when it is opened(through EXCEL) it shows as 6075. I know this isn't the simple answer you're hoping to get, but I'd create the thing in Excel format in the first place rather than using CSV as a go-between. CSV is not intended to be able to contain formatting for the fields in it. Instead, get the HSSF Java classes from Apache (they don't cost anything) and write a program that outputs a "real" Excel file. Then you can just tell it "this is a string" and it'll store it as a string, not a number. Or if you like it as a number, you could insert a cell style that tells it how the number should be formatted. That would also give you the chance to do things like set the column widths to useful sizes, adjust the fonts, underline things, insert formulas, colors, etc. If your interested, I've written some RPG samples of this sort of thing in my newsletter. Here are some links: http://www.iseriesnetwork.com/article.cfm?ID=19278 http://www.iseriesnetwork.com/article.cfm?ID=19337 Those links require a membership to the iSeries Network -- though a free "associate" membership should work. I've written other articles on the topic, but they haven't been posted to the web site yet. Those two are the "getting started" ones, though. So they're probably the ones you want.
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.