--To view this discussion on the web visit https://groups.google.com/d/msg/python-excel/-/PH6D18El-9kJ.
You received this message because you are subscribed to the Google Groups "python-excel" group.
To post to this group, send an email to python...@googlegroups.com.
To unsubscribe from this group, send email to python-excel...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/python-excel?hl=en-GB.
I've tried that and isolated the character to \x0a. But I can't seem to embed it in the xls file correctly. It goes in but the lines are delimited with a strange character. It could be a Unicode issue possibly. I have tried \x0d and a combination of the two without luck.
--
You received this message because you are subscribed to the Google Groups "python-excel" group.
To view this discussion on the web visit https://groups.google.com/d/msg/python-excel/-/0colI_odHkcJ.
You just need to enable the wrap on the style's alignment for the cell:
>>> import xlrd>>> book = xlrd.open_workbook('test.xls')>>> sheet = book.sheets()[0]
>>> import xlwt>>> book = xlwt.Workbook()>>> sheet = book.add_sheet('Test')>>> sheet.write(0, 0, 'Hello\nWorld')>>> style = xlwt.XFStyle()>>> style.alignment.wrap = 1
I executed the instructions exactly as you wrote down and gotline1$line2$line3Where $=strange character.Note: I am executing on a Solaris machine and using sftp to tranfer the xls file in binary mode. I also tested it directly on my Windows XP laptop. I get the same result.
>>> import xlrd>>> book = xlrd.open_workbook('test.xls')>>> sheet = book.sheets()[0]
The above 3 lines are redundant.
I see the "strange character", which is just the little square that
indicates the font does not include a glyph for that character. I'm
using Excel 2010 on Windows XP. I also notice that if I attempt to
edit the cell, it automatically wraps it and the glyph goes away.
Perhaps xlwt could similarly perform this transformation
automagically?
Cheers,
Ian
On Thu, Jun 9, 2011 at 2:50 PM, John Machin <sjma...@lexicon.net> wrote:
> Note that neither Dave nor I see a "strange character" . What does this
> strange character look like? What version of Excel or whatever are you using
> to view the file? What are your locale settings on the laptop?I see the "strange character", which is just the little square that
indicates the font does not include a glyph for that character. I'm
using Excel 2010 on Windows XP.
I also notice that if I attempt to
edit the cell, it automatically wraps it and the glyph goes away.
Perhaps xlwt could similarly perform this transformation
automagically?