mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-09-26 17:50:22 +02:00
fpvectorial: Fix odt and docx writers truncating the last two characters of each paragraph.
This commit is contained in:
parent
8a67172c03
commit
f823854588
@ -700,13 +700,6 @@ Var
|
||||
Begin
|
||||
sTemp := TvText(oEntity).Value.Text;
|
||||
|
||||
// Strip out the trailing line break
|
||||
// added by TStringList.Text
|
||||
If DefaultTextLineBreakStyle = tlbsCRLF Then
|
||||
sTemp := Copy(sTemp, 1, Length(sTemp) - 2)
|
||||
Else
|
||||
sTemp := Copy(sTemp, 1, Length(sTemp) - 1);
|
||||
|
||||
AddTextRun(sTemp, TvText(oEntity).Style);
|
||||
End
|
||||
Else If oEntity is TvField Then
|
||||
|
@ -10,7 +10,7 @@ program fpvtextwritetest;
|
||||
{$mode objfpc}{$H+}
|
||||
|
||||
uses
|
||||
fpvectorial, odtvectorialwriter, fpvutils, fpvectorialpkg;
|
||||
fpvectorial, odtvectorialwriter, docxvectorialwriter, fpvutils;
|
||||
|
||||
{$R *.res}
|
||||
|
||||
@ -76,6 +76,7 @@ begin
|
||||
CurList.AddParagraph('The ability to create custom components');
|
||||
|
||||
Vec.WriteToFile('text_output.odt', vfODT);
|
||||
Vec.WriteToFile('text_output.docx', vfDOCX);
|
||||
finally
|
||||
Vec.Free;
|
||||
end;
|
||||
|
@ -493,13 +493,13 @@ Begin
|
||||
|
||||
dtTime := Now;
|
||||
Vec.WriteToFile('text_output_docx', vfDOCX);
|
||||
|
||||
WriteLn('Native docx writer: '+Format('%.1f msec', [24*60*60*1000*(Now-dtTime)]));
|
||||
|
||||
dtTime := Now;
|
||||
|
||||
Vec.WriteToFile('text_output_odt', vfODT);
|
||||
|
||||
WriteLn('Native odt writer: '+Format('%.1f msec', [24*60*60*1000*(Now-dtTime)]));
|
||||
|
||||
|
||||
Finally
|
||||
Vec.Free;
|
||||
End;
|
||||
|
@ -1125,12 +1125,6 @@ begin
|
||||
// Note that here we write only text spans!
|
||||
sText := EscapeHTML(AEntity.Value.Text);
|
||||
|
||||
// Trim extra CRLF appended by TStringList.Text
|
||||
If DefaultTextLineBreakStyle = tlbsCRLF Then
|
||||
sText := Copy(sText, 1, Length(sText) - 2)
|
||||
Else
|
||||
sText := Copy(sText, 1, Length(sText) - 1);
|
||||
|
||||
sText := StringReplace(sText, ' ', ' <text:s/>', [rfReplaceAll]);
|
||||
sText := StringReplace(sText, #09, '<text:tab/>', [rfReplaceAll]);
|
||||
sText := StringReplace(sText, #13, '<text:line-break/>', [rfReplaceAll]);
|
||||
|
Loading…
Reference in New Issue
Block a user