We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Formatting / DataTables

I have all but given up trying to format a PDF using the page.Graphics.DrawText method. It works, but it''s tedious trying to format any serious amount of text. I decided to try and use the table Publish method. Since my data is coming off of objects, I decided to create my own table, and populate the rows manually. I have verified the table exists, and the rows exist, and there are values in all the columns in every row. However, I get the following error when the Publish method is called: pdfTable.Publish(new PointF(0, 0),firstPage); {"Value cannot be null.\rParameter name: Currently supported only data rows" } With this method, I have verified my pdfTable is there, and firstPage is there, so the nulls can only be something internal. I followed the "brief" example in the documentation for setting up the page/table. Here''s the DataTable/DataRow fill method... Creating the DataTable: private DataTable FormatHeaderTable() { DataTable _dtHeader = new DataTable("Header"); _dtHeader.Columns.Add("Caption",System.Type.GetType("System.String")); _dtHeader.Columns.Add("HeaderValue",System.Type.GetType("System.String")); return _dtHeader; } Finally, here''s the code to place in the values: _dr["Caption"] = caption; _dr["HeaderValue"] = headerValue; return _dr; I have verified none of the supplied values in the DataTable I populate are null. So, I would suspect something else needs to be set. Any help?

2 Replies

DS Daryl Smith January 12, 2005 02:13 AM UTC

UPDATE: I can get this to work if I place the DataTable into a DataSet, then try it (although I have to reverse the order of DataMember/DataSource that is presented in the example to get it to work, or it throws an error). The problem is that the table it generates is very narrow, and wraps all the text. Is there a way to format the width of the table? When will there be decent (or any) documentation for this product? >I have all but given up trying to format a PDF using the page.Graphics.DrawText method. It works, but it''s tedious trying to format any serious amount of text. I decided to try and use the table Publish method. > >Since my data is coming off of objects, I decided to create my own table, and populate the rows manually. I have verified the table exists, and the rows exist, and there are values in all the columns in every row. However, I get the following error when the Publish method is called: > >pdfTable.Publish(new PointF(0, 0),firstPage); > >{"Value cannot be null.\rParameter name: Currently supported only data rows" } > >With this method, I have verified my pdfTable is there, and firstPage is there, so the nulls can only be something internal. I followed the "brief" example in the documentation for setting up the page/table. > >Here''s the DataTable/DataRow fill method... >Creating the DataTable: > >private DataTable FormatHeaderTable() >{ >DataTable _dtHeader = new DataTable("Header"); >_dtHeader.Columns.Add("Caption",System.Type.GetType("System.String")); >_dtHeader.Columns.Add("HeaderValue",System.Type.GetType("System.String")); >return _dtHeader; >} > >Finally, here''s the code to place in the values: >_dr["Caption"] = caption; >_dr["HeaderValue"] = headerValue; >return _dr; > > >I have verified none of the supplied values in the DataTable I populate are null. > >So, I would suspect something else needs to be set. > > >Any help? >


AD Administrator Syncfusion Team January 13, 2005 01:56 PM UTC

Hi Daryl, Sorry for the delay in getting back to you. 1) I was able to see the issue with not being able to Import a DataTable without placing it in an DataSet. I am afraid that the support for Tables is not complete in the current version, However this is the issue that were are working on rectifying in the 3.1 patch in 3 weeks time. The Table API will be completely revamped to support complex formatting. Please let us know of any suggestions so that we can take it into consideration before while designing the API for the PDF Table. 2) Currently there is no way to configure the table width, the only thing possible is to loop through the columns and set the column width explicitly for( int i = 0, len = table.Columns.Count; i < len; ++i ) { table.Columns[ i ].Width = 10; } We will definitely provide support for setting the table width in the next release. Please let me know if you have any questions. Thanks. Best regards, Stephen. >UPDATE: I can get this to work if I place the DataTable into a DataSet, then try it (although I have to reverse the order of DataMember/DataSource that is presented in the example to get it to work, or it throws an error). The problem is that the table it generates is very narrow, and wraps all the text. Is there a way to format the width of the table? When will there be decent (or any) documentation for this product? > > >>I have all but given up trying to format a PDF using the page.Graphics.DrawText method. It works, but it''s tedious trying to format any serious amount of text. I decided to try and use the table Publish method. >> >>Since my data is coming off of objects, I decided to create my own table, and populate the rows manually. I have verified the table exists, and the rows exist, and there are values in all the columns in every row. However, I get the following error when the Publish method is called: >> >>pdfTable.Publish(new PointF(0, 0),firstPage); >> >>{"Value cannot be null.\rParameter name: Currently supported only data rows" } >> >>With this method, I have verified my pdfTable is there, and firstPage is there, so the nulls can only be something internal. I followed the "brief" example in the documentation for setting up the page/table. >> >>Here''s the DataTable/DataRow fill method... >>Creating the DataTable: >> >>private DataTable FormatHeaderTable() >>{ >>DataTable _dtHeader = new DataTable("Header"); >>_dtHeader.Columns.Add("Caption",System.Type.GetType("System.String")); >>_dtHeader.Columns.Add("HeaderValue",System.Type.GetType("System.String")); >>return _dtHeader; >>} >> >>Finally, here''s the code to place in the values: >>_dr["Caption"] = caption; >>_dr["HeaderValue"] = headerValue; >>return _dr; >> >> >>I have verified none of the supplied values in the DataTable I populate are null. >> >>So, I would suspect something else needs to be set. >> >> >>Any help? >>

Loader.
Live Chat Icon For mobile
Up arrow icon