[英]Create DataGrid from list of object
我有这两节课:
public class FrigoriferoClass
{
public int codice { get; set; }
public string contenuto { get; set; }
public int tempMin { get; set; }
public int tempMax { get; set; }
public List<ControlloClass> controllo { get; set; }
public FrigoriferoClass(int cod, string cont, int min, int max)
{
controllo = new List<ControlloClass>();
codice = cod;
contenuto = cont;
tempMin = min;
tempMax = max;
}
}
和:
public class ControlloClass
{
public int temp { get; set; }
public DateTime data { get; set; }
public ControlloClass(int t, DateTime d)
{
temp = t;
data = new DateTime();
data = d;
}
}
我创建了FrigoriferoClass
列表,并希望使用其中的一些数据创建网格。 我希望网格看起来像这样(例如,我仅在excel上做到了):
之后,我需要使用此网格创建一个pdf
文件。
我尝试使用syncfusion,但是我不知道如何以这种方式制作网格。
有人可以帮助我吗? 谢谢!
using Syncfusion.XlsIO;
using Syncfusion.Pdf;
using Syncfusion.ExcelToPdfConverter;
...
// in a method
using (Stream readFile = stream for excel file)
{
ExcelToPdfConverter converter = new ExcelToPdfConverter(readFile);
PdfDocument pdfDoc = new PdfDocument();
// set Your setting You like
ExcelToPdfConverterSettings settings = new ExcelToPdfConverterSettings();
settings.TemplateDocument = pdfDoc;
settings.DisplayGridLines = GridLinesDisplayStyle.Invisible;
pdfDoc = converter.Convert(settings);
pdfDoc.Save("ExceltoPDF.pdf", Response, HttpReadType.Save);
readFile.Close();
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.