Is their a way to format a column as a date and also as a currency?
PdfStringFormat format = new PdfStringFormat();
format.Alignment = PdfTextAlignment.Right;
format.LineAlignment = PdfVerticalAlignment.Bottom;
(How to set as currency or date mm/dd/yyyy)
pdfGrid.Columns[3].Format = format;
public async void PdfExport()
{
//Create a new PDF document
PdfDocument doc = new PdfDocument();
//Add a page
PdfPage page = doc.Pages.Add();
//Create a PdfGrid
PdfGrid pdfGrid = new PdfGrid();
//Add IEnumerable
DateTime dt1 = new DateTime(2019, 06, 01);
DateTime dt2 = new DateTime(2019, 09, 30);
IEnumerable repqtrtransactions;
repqtrtransactions = await M_Transactions.RepQuarterlyTrades(9, dt1, dt2);
//Assign data source
pdfGrid.DataSource = repqtrtransactions;
PdfStringFormat format = new PdfStringFormat();
format.Alignment = PdfTextAlignment.Right;
format.LineAlignment = PdfVerticalAlignment.Bottom;
pdfGrid.Columns[3].Format = format;
//Apply built-in table style
pdfGrid.ApplyBuiltinStyle(PdfGridBuiltinStyle.GridTable4Accent1);
//Draw grid to the page of PDF document
pdfGrid.Draw(page, new Syncfusion.Drawing.PointF(10, 10));
//Creating the stream object
MemoryStream stream = new MemoryStream();
//Save the PDF document to stream.
doc.Save(stream);
//If the position is not set to '0' then the PDF will be empty.
stream.Position = 0;
//Close the document.
doc.Close(true);
//Defining the ContentType for pdf file.
string contentType = "application/pdf";
//Define the file name.
string fileName = "Output.pdf";
var path = "Upload/QtrReports/" + fileName;
//You have to rewind the MemoryStream before copying
stream.Seek(0, SeekOrigin.Begin);
using (FileStream fs = new FileStream(path, FileMode.OpenOrCreate))
{
stream.CopyTo(fs);
fs.Flush();
}
}