- Offizieller Beitrag
The new API TableAdd is a powerful but still easy to use possibility to create a table in code. Using a callback function you can set properties for each cell and also create the text.
Here we want to show how to create an empty table and move it to the horizontal center of the page:
Code
var par : TParagraph;
begin
par := WPRichText1.TableAdd(5,10,[wptblActivateBorders, wptblAppendTableAtEnd],nil,nil);
par.ASet(WPAT_BoxWidth, WPCentimeterToTwips(10));
par.ASet(WPAT_BoxMarginLeft,
(WPRichText1.Header.PageWidth -
WPCentimeterToTwips(10)) div 2
- WPRichText1.Header.LeftMargin
);
WPRichText1.DelayedReformat;
end;
Alles anzeigen