如何使用c#删除excel表格中的删除行?
我试过这个:
{
Excel.Application app = new Excel.Application();
Excel.Workbook workbook = app.Workbooks.Open("D:/Excel.xlsx", Type.Missing, Type.Missing,
Type.Missing, Type.Missing, Type.Missing,
Type.Missing, Type.Missing, Type.Missing,
Type.Missing, Type.Missing, Type.Missing,
Type.Missing, Type.Missing, Type.Missing);
Excel.Worksheet ws = (Excel.Worksheet)app.Sheets["Production_2013"];
Excel.Range range = ws.get_Range("A5", "T10");
string clean_string = CleanStrikethroughChars(range);
}
string CleanStrikethroughChars(Excel.Range range) {
string s = "";
int char_index = 1;
int length = range.Cells.Value2.ToString().Length;
while (char_index < length) {
if ((bool)range.Cells.get_Characters(char_index, 1).Font.Strikethrough) {
s += range.Cells.get_Characters(char_index, 1).Text;
char_index++;
}
}
return s;