public CorrectSheetOutput(Workbook outputBook, SheetReader reader, TipStyle styles, ValidateColumnCollection columns) { outputBook.CalculateFormula(); _output_book = outputBook; _reader = reader; _reader.ConvertFormulaToValue(); _styles = styles; _new_index = 1; try { _target_sheet = outputBook.Worksheets[SheetName]; _target_sheet.Cells.ClearContents(0, 0, _target_sheet.Cells.MaxDataRow, _target_sheet.Cells.MaxDataColumn); Range rng = _target_sheet.Cells.CreateRange(0, 0, _target_sheet.Cells.MaxRow + 1, _target_sheet.Cells.MaxColumn + 1); rng.Style = _styles.Normal; } catch (Exception) { int index = outputBook.Worksheets.Add(); _target_sheet = outputBook.Worksheets[index]; _target_sheet.Name = SheetName; } _columns = columns; foreach (ValidateColumn each in columns.Values) { _target_sheet.Cells[0, each.Index].PutValue(each.Name); _target_sheet.Cells[0, each.Index].Style = _styles.Normal; } _target_sheet.ClearComments(); }
public RowCellEnumerator(SheetReader reader, ValidateColumnCollection columns) { _reader = reader; _columns = new List <string>(); _current_index = -1; foreach (ValidateColumn each in columns.Values) { _columns.Add(each.Name); } }
public SheetRowSource(SheetReader reader, ValidateColumnCollection columns) { _reader = reader; _cell_enumerator = new RowCellEnumerator(_reader, columns); _columns = columns; foreach (ValidateColumn each in columns.Values) { if (!_reader.Columns.ContainsKey(each.Name)) { throw new ArgumentException("來源資料中不包含此欄位。(" + each.Name + ")"); } } }
public CorrectSheetOutput(Workbook outputBook, SheetReader reader, TipStyle styles, ValidateColumnCollection columns) { outputBook.CalculateFormula(); _output_book = outputBook; _reader = reader; _reader.ConvertFormulaToValue(); _styles = styles; _new_index = 1; try { _target_sheet = outputBook.Worksheets[SheetName]; _target_sheet.Cells.ClearContents(0, 0, _target_sheet.Cells.MaxDataRow, _target_sheet.Cells.MaxDataColumn); Range rng = _target_sheet.Cells.CreateRange(0, 0, _target_sheet.Cells.MaxRow + 1, _target_sheet.Cells.MaxColumn + 1); // 2017/8/22 穎驊依據高雄小組專案 [03-05][04+] EXCEL匯入格式可否修正為xlsx也可匯入? 更改為新版 Aspose.Cells_201402 寫法 ,SetStyle() //rng.Style = _styles.Normal; rng.SetStyle(_styles.Normal); } catch (Exception) { int index = outputBook.Worksheets.Add(); _target_sheet = outputBook.Worksheets[index]; _target_sheet.Name = SheetName; } _columns = columns; foreach (ValidateColumn each in columns.Values) { _target_sheet.Cells[0, each.Index].PutValue(each.Name); // 2017/8/22 穎驊依據高雄小組專案 [03-05][04+] EXCEL匯入格式可否修正為xlsx也可匯入? 更改為新版 Aspose.Cells_201402 寫法 ,SetStyle() //_target_sheet.Cells[0, each.Index].Style = _styles.Normal; _target_sheet.Cells[0, each.Index].SetStyle(_styles.Normal); } _target_sheet.ClearComments(); }