Hi all

I am working on a project to write to Excel. We use Giuseppe's SQL2JXL for this, and it is using the native JDBC driver as I'm executing it. The JT400 driver is an option, tried that, but no difference for my needs.

I have content in a cell that is best presented in multiple lines - not rows, for good reasons. In Excel, this is done with the Alt-Enter to get new lines.

In Excel, you can put a value in a cell that has CHAR(10) - NL - between lines - this is how it is done.

On the i, I'm using x'15' for the NL.

So I insert NL between the values, as here - KitchenNLService AreaNLExterior

This should display in the cell like this -

Kitchen
Service Area
Exterior

Instead, it looks like this -

KitchenService
AreaExterior

It seems the control character x'15' has been stripped - I want it to convert to ASCII x'0A'

Here is the section of the Java class that is getting the character string from the result set - it uses getString and Label class - is one of these stripping out control characters?

case Types.CHAR:
default:
String cValue = rs.getString (colNum+1);
if (rs.wasNull ()) {
label = new Label(colNum, rowNum, nullValue);
sheet.addCell(label);
} else {
if (LTRIM.equals("Y"))
cValue = cValue.trim();
else
if (cValue.trim().length() > 0) cValue = trimRight(cValue);
else break;
if (cValue.length() > 0) {
label = new Label(colNum, rowNum, cValue);
sheet.addCell(label);
}
}


I CAN set up a formula in the character column, like this - =CONCATENATE("Kitchen",CHAR(10),"Service Area",CHAR(10),"Exterior")

That displays exactly that way, forcing the user to waltz down through the column and press enter on each cell - not a good thing for people that aren't Excel experts, and not something to demand of anyone.

I know I could use POI (Scott's API set over it), we do that for some stuff - this is faster, and I'm maybe asking too much of it.

As an Amazon Associate we earn from qualifying purchases.

This thread ...


Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2021 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.