Printing datagridview in a table

edited 2:53PM in FastReport .NET
Hello,
I'm trying to print a DataGridView content in a TableObject and so far am failing.
Tried to use report.RegisterData with DataGridRow, but can't get cell content, like this:

<!--fonto:Courier New--><span style="font-family:Courier New"><!--/fonto-->table[colIndex, 1].Text = String.Format("[DataGridViewRow.Cells[{0}].Value]", someIndex)<!--fontc--></span><!--/fontc-->

at report.Prepare this code throws "error CS0120: An object reference is required for the nonstatic field, method, or property 'System.Windows.Forms.DataGridViewRow.Cells.get'"
Is there another way?

BTW, IMO you could add aliasing of datasource names when business-objects are used, currently, if I understand correctly,
DataSourceName MUST be be equal to the type name (and this is not stated clearly in the documentation)

Thanks,
Georgi

Comments

  • edited 2:53PM
    Hello,

    You may register the DataTable (or any other datasource that you use in the DataGridView) in a report, then print this datasource. See the demo.exe, the "Table/Print DataTable" report.
    wrote:
    DataSourceName MUST be be equal to the type name
    No, you may use any name.
  • edited 2:53PM
    Thank you for your answer. The reason I wanted to print DataGridView rather than DataTable is that I need to preserve the sorting imposed by the user.
    I finally managed to do that by copying grid rows into a List of objects of dynamically generated type.
    AlexTZ wrote: »
    Hello,

    You may register the DataTable (or any other datasource that you use in the DataGridView) in a report, then print this datasource. See the demo.exe, the "Table/Print DataTable" report.
    AlexTZ wrote: »
    DataSourceName MUST be be equal to the type name
    No, you may use any name.
  • edited 2:53PM
    I could not find any support for Fillable Forms in a PDF Export in version 2014.1.3

    Are there any plans on the roadmap to add Fillable Forms when exporting a PDF, or are there other solutions to add Fillable Forms to a PDF which are generated with Fast Report .NET?

Leave a Comment

Rich Text Editor. To edit a paragraph's style, hit tab to get to the paragraph menu. From there you will be able to pick one style. Nothing defaults to paragraph. An inline formatting menu will show up when you select text. Hit tab to get into that menu. Some elements, such as rich link embeds, images, loading indicators, and error messages may get inserted into the editor. You may navigate to these using the arrow keys inside of the editor and delete them with the delete or backspace key.