How to print a flex grid using BSPrinter
The MSFlexGrid, MSHFlexGrid and any other compatible flex grid control can be printed with BSPrinter
The specific code needed is this line:.
PrintPreview1.PrintGrid MSFlexGrid1
Where 'PrintPreview1' is the name of the PrintPreview control and 'MSFlexGrid1' is the name of the flex grid control.
This is the result:
And the user can change the style by clicking this button:
This method can be used to print any Recordset, you just need to put it in a flex grid, that does not need to be visible.
To see further about printing the flex grid, you can see the samples that are installed by the installer
In the sample projects that are installed by the installer at [Program Files]\BSPrinter\Samples or [Program Files (x86)]\BSPrinter\Samples on Windows 64 bits, there are two related samples, they are:
3 - Print FlexGrid
20 - Change the default grid style when printing a grid (under: 8 - Advanced samples 1)
Reference
PrintGrid method.