示例#1
0
        public void WorksheetDeleteRowTest()
        {
            MemoryStream        stream        = SpreadsheetReader.Create();
            SpreadsheetDocument doc           = SpreadsheetDocument.Open(stream, true);
            WorksheetPart       worksheetPart = SpreadsheetReader.GetWorksheetPartByName(doc, "Sheet1");

            WorksheetWriter writer = new WorksheetWriter(doc, worksheetPart);

            writer.PasteText("D3", "Row 3");
            writer.PasteText("D4", "Row 4");
            writer.PasteText("D5", "Row 5");

            //Delete row 3
            writer.DeleteRow(3);

            //Save to the memory stream, and then to a file
            SpreadsheetWriter.Save(doc);
            SpreadsheetWriter.StreamToFile(string.Format("{0}\\deleterow.xlsx", GetOutputFolder()), stream);
        }