WPCubed Product Support

background color of a table

Hi

I'd like to know how can I change the rows' background color of a table, but my document have many tables, how can I specify the one that I want to be modified.

And how can I dynamically open an image? I want to store the image in a directory and on opening the document it shows that image from the directory.

Thanks

#1 ♥ 0
5.2k Views 2 users read 2 min
support

I'd like to know how can I change the rows' background color of a table, but my document have many tables, how can I specify the one that I want to be modified.

You can locate the table when using its name (MoveToTable) or by searching for text inside of it.

And how can I dynamically open an image? I want to store the image in a directory and on opening the document it shows that image from the directory.

You need to insertert a linked image. If the property StreamName of the image is not empty the editor loads the contents from the provided filename (if it is one). It is also possible to loadf it through an event - OnHTTPLoadImage event.

Julian

#2 ♥ 0

Hi, Julian

Thanks for helping

But I have one more question, how can I define a name for a created table?

Thanks

#3 ♥ 0

I achieved to change the table's background color, but only for the first line, How can I modify the table's background color of each other line?
Like one line gray, the second white, the third gray, the fourth white...

I tried with the code below:

var
  par: TParagraph;
begin
  par := WPRichText1.FindParWithText('XXX');
  if (par <> nil) and (par.ParentTable <> nil) then
  begin
    par := par.ParentPar;
    par.ASetColor(WPAT_FGColor, clBlue);
    par.ASetColor(WPAT_BGColor, clWhite);
    WPRichText1.Refresh();
  end;
end;

Thanks

#4 ♥ 0
support

Hi,

Over the table objects you have access to all rows and columns - see properties Cols and Rows or better create a paragraph loop.

par := table.ChildPar;
while par<>nil do
begin
...
par := par.NextPar;
end;

#5 ♥ 0
This category is archived. No new posts are possible.