You will also want to reset mRow and newpage either in the button click or BeginPrint event. It is also not prepared for the Document to be shown again or Printed.It is also needlessly using single and RectangleF.There is an internal gutter or margin so that text does not print too close to gridlines - this just uses an offset of 1 or 2. Because it is not actually printing the correct number of rows, once you fix that you'll find that it reprints the last row from the previous page as the first row of a new page.It is not allowing for invisible columns or columns with other than default alignment, There could be other such settings you want to account for.Printing the column headers is done once per page, so it doesnt need to be in the data print loop at all.It uses the newpage flag to print the header or the first row when there is a new page. The original code is a nice start but has a couple of bugs and inefficiecies:
0 Comments
Leave a Reply. |