ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Problem while copying JTable contents into Excel with line breaksincluded (https://www.excelbanter.com/excel-programming/435320-problem-while-copying-jtable-contents-into-excel-line-breaksincluded.html)

chaithanya m

Problem while copying JTable contents into Excel with line breaksincluded
 
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/tutorials...t-with-ex.aspx

joel[_68_]

Problem while copying JTable contents into Excel with line breaksincluded
 

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.


--
joel
------------------------------------------------------------------------
joel's Profile: http://www.thecodecage.com/forumz/member.php?userid=229
View this thread: http://www.thecodecage.com/forumz/sh...d.php?t=147157



All times are GMT +1. The time now is 10:36 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com