Embedding New Line Character in XML Spreadsheet (Excel)

Hi Friends,

Hope all are doing well.

I running with below problem here. please let me know if anyone have
workaround on this.

I am generating excel spreadsheet using XML representation for cells
and rows in ROR. now within content of a cell i need to enter new line
character (means need to put line break) between some content. i have
searched at various places for this and found that for adding line
break (Alt + Enter), its required to embed between any
content.
and then i tried to put between the content of a cell but it
got interpreted as in the excel sheet. if i save the excelsheet
as xml spreadsheet and check the content in wordpad its showing

 in the cell content.

for an example i tried as given below.

xml.Row ‘ss:StyleID’ => ‘s65’ do
xml.Cell ‘ss:StyleID’ => ‘s70’ do
xml.Data “test” + " " + “test 3”, ‘ss:Type’ =>
‘String’
end
end

So here i was expecting data test and test 3 need to be separated by
line break but in the excel sheet it is showing as test test 3 and
saving and opening as xml shpreadsheet it is showing as
test
test 3

Apart from that i tried to puts"\n",
etc tags but it is putting
space for this characters.

Please let me know if anyone has any solution on this.

Thanks in advance.

Thanks,
Piyush

did you try

10.chr

Yes.i have tried putting 10.chr as as below

xml.Row ‘ss:StyleID’ => ‘s65’ do
xml.Cell ‘ss:StyleID’ => ‘s70’ do
xml.Data “test” + 10.chr + “test 3”, ‘ss:Type’ =>
‘String’
end
end

But it is putting a space instead of a line break.

Thanks,
Piyush

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs