rvitem to be exported as image

General TRichView support forum. Please post your questions here
Post Reply
cychia_n2n
Posts: 16
Joined: Mon May 09, 2016 9:16 am

rvitem to be exported as image

Post by cychia_n2n »

Is there any way i can save the rvitem like TableItem into a image file?
Sergey Tkachenko
Site Admin
Posts: 17569
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

You can make an image from a document, not from an item.
Copy this item to a new document, load it in TRVReportHelper, save as an image (Demos\DelphiUnicode\Assorted\Graphics\ToImage\)
cychia_n2n
Posts: 16
Joined: Mon May 09, 2016 9:16 am

Post by cychia_n2n »

I am going to have a feature to allow user to create table styles, after setting up the table styles, i am thinking to generate a thumbnail of the table style and it will be shown in the list box when choosing styles to apply to table.

I am using the ToImage demo as example, but I am struggling to work out a fixed table size with 5x5 col rows. I want my thumbnail to be around the size of 50x60.

Any guidance?

Thanks.
Sergey Tkachenko
Site Admin
Posts: 17569
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

You can assign BestWidth and BestHeight properties of cells.
Note that the total cell width = (CellBorderWidth + CellHPadding)* 2 + Cell.BestWidth.
TotalTableWidth = (BorderWidth + BorderHSpacing) * 2 + TotalCellWidth * ColCount + CellHSpacing * (ColCount - 1).
You can use this equation to calculate the proper BestWidth for the given TotalTableWidth.
Height is calculated similarly.

PS: for the width, you can also simply assign Table.BestWidth; but for the height, this calculation is necessary.

PPS: Include rvtoIgnoreContentWidth and rvtoIgnoreContentHeight in table.Options

Update: of course, ColCount must be used for horizontal size, not RowCount.
Post Reply