diff --git a/components/fpspreadsheet/examples/ooxmldemo/ooxmlwrite.lpr b/components/fpspreadsheet/examples/ooxmldemo/ooxmlwrite.lpr index 91602a785..521bb7ec2 100644 --- a/components/fpspreadsheet/examples/ooxmldemo/ooxmlwrite.lpr +++ b/components/fpspreadsheet/examples/ooxmldemo/ooxmlwrite.lpr @@ -70,6 +70,10 @@ begin MyWorksheet.WriteBorderStyle(4, 4, cbSouth, lsThick, scBlue); Myworksheet.WriteHorAlignment(4, 4, haRight); + // Wordwrap + MyWorksheet.WriteUTF8Text(4, 6, 'This is a long, long, long, wrapped text.'); + MyWorksheet.WriteWordwrap(4, 6, true); + // Creates a new worksheet MyWorksheet := MyWorkbook.AddWorksheet('My Worksheet 2'); diff --git a/components/fpspreadsheet/xlsxooxml.pas b/components/fpspreadsheet/xlsxooxml.pas index 4fca94547..89769af29 100755 --- a/components/fpspreadsheet/xlsxooxml.pas +++ b/components/fpspreadsheet/xlsxooxml.pas @@ -510,15 +510,22 @@ begin vaBottom: sAlign := sAlign + 'vertical="bottom" '; end; + if (uffWordWrap in styleCell.UsedFormattingFields) then + sAlign := sAlign + 'wrapText="1" '; + { Fill } - fillID := FindFillInList(@styleCell); - if fillID = -1 then fillID := 0; - s := s + Format('fillId="%d" ', [fillID]); + if (uffBackgroundColor in styleCell.UsedFormattingFields) then begin + fillID := FindFillInList(@styleCell); + if fillID = -1 then fillID := 0; + s := s + Format('fillId="%d" applyFill="1" ', [fillID]); + end; { Border } - borderID := FindBorderInList(@styleCell); - if borderID = -1 then borderID := 0; - s := s + Format('borderId="%d" ', [borderID]); + if (uffBorder in styleCell.UsedFormattingFields) then begin + borderID := FindBorderInList(@styleCell); + if borderID = -1 then borderID := 0; + s := s + Format('borderId="%d" applyBorder="1" ', [borderID]); + end; { Write everything to stream } if sAlign = '' then