示例#1
0
        public string FileUpdate_WriteAndUpdatingWithOneRow_Updated()
        {
            var worksheet = new Worksheet();
            var cells     = new List <CellRow>();

            cells.Add(TestCellRow);

            worksheet.PopulateRows(cells, usePropertiesAsHeadings: true);

            var templateFile = new FileInfo(TemplateFilePath);
            var inputFile    = new FileInfo(Path.Combine(ResourcesPath, "temp.xlsx"));

            if (inputFile.Exists)
            {
                inputFile.Delete();
                inputFile.Refresh();
            }


            //Writing Data One Row
            using (var fastExcel = new FastExcel(templateFile, inputFile))
            {
                fastExcel.Write(worksheet, "Sheet1");
            }

            inputFile.Refresh();
            using (var fastExcel = new FastExcel(inputFile))
            {
                fastExcel.Update(worksheet, "Sheet1");
            }

            return(FileRead_ReadingSpecialCharactersCore_Read(inputFile));
        }
示例#2
0
        public string FileUpdate_UpdatingWithOneRow_Updated()
        {
            var worksheet = new Worksheet();
            var cells     = new List <CellRow> {
                TestCellRow
            };

            worksheet.PopulateRows(cells, usePropertiesAsHeadings: true);

            var templateFile = new FileInfo(Path.Combine(ResourcesPath, "OneRowFile.xlsx"));
            var inputFile    = templateFile.CopyTo(Path.Combine(ResourcesPath, "temp.xlsx"), true);

            using (var fastExcel = new FastExcel(inputFile))
            {
                fastExcel.Update(worksheet, "Sheet1");
            }

            return(FileRead_ReadingSpecialCharactersCore_Read(inputFile));
        }
示例#3
0
        public string FileUpdate_UpdatingEmptyFile_Updated()
        {
            var worksheet = new Worksheet();
            var cells     = new List <CellRow>();

            cells.Add(TestCellRow);

            worksheet.PopulateRows(cells, usePropertiesAsHeadings: true);
            var templateFile = new FileInfo(TemplateFilePath);
            var inputFile    = templateFile.CopyTo(Path.Combine(ResourcesPath, "temp1.xlsx"), true);

            using (var fastExcel = new FastExcel(inputFile))
            {
                // Read the data
                fastExcel.Update(worksheet, "Sheet1");
            }


            return(FileRead_ReadingSpecialCharactersCore_Read(inputFile));
        }