Ejemplo n.º 1
0
        private static void WriteWorkbook(string fName)
        {
            Console.WriteLine("Creating workbook named [{0}]", fName);
            XlWorkbook   book   = new XlWorkbook();
            XlWorksheets sheets = book.Worksheets;
            XlSchema     schema = GetDeploymentSchema();
            XlWorksheet  sheet  = sheets.AddWorksheet("DET_Deployments", XlColor.White, schema);

            GetDeploymentRows(sheet);
            schema = GetMeasurementSchema();
            sheet  = sheets.AddWorksheet("DET_Measurements", XlColor.White, schema);
            GetMeasurementRows(sheet);
            schema = GetSiteSchema();
            sheet  = sheets.AddWorksheet("LIST_Sites", XlColor.Orange, schema);
            GetSiteRows(sheet);
            schema = GetSensorSchema();
            sheet  = sheets.AddWorksheet("LIST_Sensors", XlColor.Orange, schema);
            GetSensorRows(sheet);
            XlCustomProperties properties = book.Properties;

            properties.AddCustomProperty("oncorId", Guid.NewGuid().ToString());
            properties.AddCustomProperty("oncorUser", "Dr. Frank N. Furter, ESQ");
            book.Save(fName);
            Console.WriteLine("Closing workbook named [{0}]", fName);
        }
Ejemplo n.º 2
0
        private XlWorkbook CreateWorkBook(IEnumerable <DataTab> tables)
        {
            XlWorkbook book = new XlWorkbook();

            foreach (DataTab tab in tables)
            {
                AddRows(book, tab);
            }
            XlCustomProperties properties = book.Properties;

            properties.AddCustomProperty("oncorId", Id.ToString());
            properties.AddCustomProperty("oncorUser", Owner);
            return(book);
        }
Ejemplo n.º 3
0
 public static Guid GetFileId(FilestoreFile excelDet)
 {
     if (excelDet != null)
     {
         try
         {
             XlCustomProperties props = XlWorkbook.LoadProperties(excelDet);
             foreach (XlCustomProperty property in props)
             {
                 if (property.Name == "oncorId")
                 {
                     string guidValue = property.Value;
                     if (!string.IsNullOrEmpty(guidValue))
                     {
                         return(Guid.Parse(guidValue));
                     }
                 }
             }
         }
         catch { }
     }
     return(Guid.Empty);
 }