I am trying to bind a datasource to a pdf Grid in .Net Core.
I used the following code from your examples but am recieving an error on the creation of the DataTable, and its properties.
I get the following error: - 'DataTable' does not contain a constructor which takes 0 arguments.
do you have any examples for .Net Core?
//https://help.syncfusion.com/file-formats/pdf/working-with-tables
public IActionResult PdfGrid(int paperId)
{
//Create a new PDF document.
PdfDocument doc = new PdfDocument();
//Add a page.
PdfPage page = doc.Pages.Add();
//Create a PdfGrid.
PdfGrid pdfGrid = new PdfGrid();
//Create a DataTable.
System.Data.DataTable table = new DataTable(); //Add columns to the DataTable
table.Columns.Add("ID");
table.Columns.Add("Name");
//Add rows to the DataTable.
table.Rows.Add(new object[] { "E01", "Clay" });
table.Rows.Add(new object[] { "E02", "Thomas" });
//Assign data source.
pdfGrid.DataSource = table;
//Draw grid to the page of PDF document.
pdfGrid.Draw(page, new PointF(10, 10));
//Saving the PDF to the MemoryStream
MemoryStream ms = new MemoryStream();
doc.Save(ms);
//If the position is not set to '0' then the PDF will be empty.
ms.Position = 0;
//Download the PDF document in the browser.
FileStreamResult fileStreamResult = new FileStreamResult(ms, "application/pdf");
fileStreamResult.FileDownloadName = "OrderPaper.pdf";
return fileStreamResult;
}