First of all, thanks Simon for your great Excel Writer, its very cool and very easy to understand.
I saw that you write the Source Code of the excel as a webpage in Excel’s 2004 XML Format, and then save it with .xls extension.
So, I wondered if it exists a function that Wrap Text
- So I made a simple Excel worksheet with wrapped text, and then save as XML file.
- I open it in TextEdit and I found some interesting attribute: ss:ss:WrapText=“1” , So, when Its unwrapped Value=0, and when its wrapped becames to 1.
- So I add this on the Sourcecode method of xlStyle class:
Select Case xlAutoAdjustText
case False
st = st + " ss:WrapText="“0"”"
case True
st = st + " ss:WrapText="“1"”"
End Select
- Made a Boolean property named “xlAutoAdjustText”
- Made a computed property named “StyleAdjust”
5.1) Get = return Styles(UBound(Styles)).xlAutoAdjustText
5.2) Set = Styles(UBound(Styles)).xlAutoAdjustText = value - Write an Excel, declare the Styles at the beginning of text, as this:
xl.AddStyle("SBS000026")
xl.StyleHorizontal = xlAlignLeft
xl.StyleAdjust = TRUE
- Use it:
xl.SetCellValue(11, i+10, “Testing Text”)//COLUMN, ROW
xl.SetCellStyleID(11, i+10, “SBS000026”)
Et voila!, wrapped text!.
If I made something wrong or someone suggest a better solution, pls tell me.
Thanks