Problem while copying JTable contents into Excel with line breaksincluded

C

chaithanya m

Hai every one
I have a Standalone application in which I am trying to copy contents of JTable into my Excel with line breaks included in my cells of JTable. I have used wrapping using "\"" to my cell contents. It's working fine but I am getting a square box type of symbol in Excel. How to remove the symbol using java while copying? Is there any way to do this?I need a new line to be present in my Excel also similar to my Jtable.I have tried to get the values of that box but i can't find the solution.I have replace "\n" with "\r\n" also but anything is not working.Can any one help me

Thank You
Chaithu

EggHeadCafe - Software Developer Portal of Choice
Essential ASP.NET with Examples in VB.NET
http://www.eggheadcafe.com/tutorial...4c-e77501d4a63b/essential-aspnet-with-ex.aspx
 
J

joel

It may be just \r. You can use in VBA VBCR, VBLF, VBCRLF instead of \r.
If none of thes work I usually dump the stinrg into the worksheet.


RowCount = 1
for i = 1 to len(MyStr)
Range("A" & rowcount) = mid(MyStr,1,1)
Range("B" & RowCount) = asc(mid(MyStr,1,1))
RowCount = RowCount + 1
next i


this will give you the Ascii values of each of the characters in the
string. Then you can use replace and instead of specifying the
character use the number with Chr(x)


like this

replace(MyStr,chr(10),chr(13))

It it turns out to be just \r then you may want to replace with Chr(13)
& chr(10). windows uses both the \CR and \LF.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top