procedure TfrmODTHandler.Button1Click(Sender: TObject);
var
Document : TvVectorialDocument;
Page : TvTextPageSequence;
Paragraph : TvParagraph;
BoldTextStyle : TvStyle;
StrikeThroughTextStyle : TvStyle;
begin
Document := TvVectorialDocument.Create;
try
// Adds the defaut Paragraph Styles
// StyleTextBody, StyleHeading1,
// StyleHeading2 & StyleHeading3
Document.AddStandardTextDocumentStyles(vfODT);
// Add our own Style
BoldTextStyle := Document.AddStyle();
BoldTextStyle.Kind := vskTextSpan;
BoldTextStyle.Name := 'Bold';
BoldTextStyle.Font.Bold := true;
BoldTextStyle.Font.Italic := true;
BoldTextStyle.Font.Color := TColorToFPColor(clRed);
BoldTextStyle.SetElements := BoldTextStyle.SetElements +
[spbfFontBold, spbfFontItalic, spbfFontColor];
StrikeThroughTextStyle := Document.AddStyle();
StrikeThroughTextStyle.Kind := vskTextSpan;
StrikeThroughTextStyle.Name := 'StrikeThrough';
StrikeThroughTextStyle.Font.StrikeThrough := true;
StrikeThroughTextStyle.SetElements := StrikeThroughTextStyle.SetElements +
[spbfFontStrikeThrough];
Page := Document.AddTextPageSequence;
Paragraph := Page.AddParagraph;
Paragraph.AddText('Hello ').Style := StrikeThroughTextStyle;
Paragraph.AddText('world').Style := BoldTextStyle;
Document.WriteToFile('Hello world.odt', vfODT);
finally
Document.Free;
end;
end;