private static void Main()
        {
            var fi = new FileInfo("../../SampleSpreadsheet.xlsx");

            // Retrieve range from Sheet1
            var data = SmlDataRetriever.RetrieveRange(fi.FullName, "Sheet1", "A1:C3");

            Console.WriteLine(data);

            // Retrieve entire sheet
            data = SmlDataRetriever.RetrieveSheet(fi.FullName, "Sheet1");
            Console.WriteLine(data);

            // Retrieve table
            data = SmlDataRetriever.RetrieveTable(fi.FullName, "VehicleTable");
            Console.WriteLine(data);
        }
Пример #2
0
        public void Sample1()
        {
            var fi = new FileInfo(GetFilePath("SampleSpreadsheet.xlsx"));

            // Retrieve range from Sheet1
            var data = SmlDataRetriever.RetrieveRange(fi.FullName, "Sheet1", "A1:C3");

            Log.WriteLine(data.ToString());

            // Retrieve entire sheet
            data = SmlDataRetriever.RetrieveSheet(fi.FullName, "Sheet1");
            Log.WriteLine(data.ToString());

            // Retrieve table
            data = SmlDataRetriever.RetrieveTable(fi.FullName, "VehicleTable");
            Log.WriteLine(data.ToString());
        }
Пример #3
0
        static void Main(string[] args)
        {
            FileInfo fi = null;

            fi = new FileInfo("../../SampleSpreadsheet.xlsx");

            // Retrieve range from Sheet1
            XElement data = SmlDataRetriever.RetrieveRange(fi.FullName, "Sheet1", "A1:C3");

            Console.WriteLine(data);

            // Retrieve entire sheet
            data = SmlDataRetriever.RetrieveSheet(fi.FullName, "Sheet1");
            Console.WriteLine(data);

            // Retrieve table
            data = SmlDataRetriever.RetrieveTable(fi.FullName, "VehicleTable");
            Console.WriteLine(data);
        }
        public void SH005_ConvertSheet(string name, string sheetName)
        {
            FileInfo sourceXlsx = new FileInfo(Path.Combine(TestUtil.SourceDir.FullName, name));

            var sourceCopiedToDestXlsx = new FileInfo(Path.Combine(TestUtil.TempDir.FullName, sourceXlsx.Name.Replace(".xlsx", "-1-Source.xlsx")));

            if (!sourceCopiedToDestXlsx.Exists)
            {
                File.Copy(sourceXlsx.FullName, sourceCopiedToDestXlsx.FullName);
            }

            var dataTemplateFileNameSuffix = "-2-Generated-XmlData-Entire-Sheet.xml";
            var dataXmlFi = new FileInfo(Path.Combine(TestUtil.TempDir.FullName, sourceXlsx.Name.Replace(".xlsx", dataTemplateFileNameSuffix)));

            using (SpreadsheetDocument sDoc = SpreadsheetDocument.Open(sourceXlsx.FullName, true))
            {
                var settings = new SmlToHtmlConverterSettings();
                var rangeXml = SmlDataRetriever.RetrieveSheet(sDoc, sheetName);
                rangeXml.Save(dataXmlFi.FullName);
            }
        }