从对象列表创建DataGrid

时间:2016-08-06 14:58:34

标签: c# grid uwp

我有这两个类:

5/3

<?php
  switch($x) {
      case 1: case 2: case 3:
      switch($y) {
          case 1: case 2:
          doTask(1);
          break;
          case 3: case 4:
          doTask(2);
          break;
          default:
          doTask(3);
      }
      break;
      case 4: case 5:
      switch($y) {
          case 1: case 2: case 4:
          doTask(4);
          break;
          case 3:
          doTask(2);
          break;
          default:
          doTask(2);
      }
      break;
      default:
      switch($y) {
          case 1:
          doTask(6);
          break;
          case 2: case 3: case 4:
          doTask(2);
          break;
          default:
          doTask(3);
      }
  }
?>

我创建了一个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; } } 列表,并且我想创建一些网格数据。 我希望网格看起来像这样(我只在excel上制作了它):

Example

之后我需要使用此网格创建一个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; } } 文件。

我尝试使用syncfusion,但我不知道如何以这种方式制作网格。

任何人都可以帮助我吗?谢谢!

1 个答案:

答案 0 :(得分:0)

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();
}