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();
        }
예제 #2
0
        public CommentOutput(SheetReader reader, TipStyle styles)
        {
            _reader  = reader;
            _sheet   = reader.Sheet;
            _columns = reader.Columns;
            _styles  = styles;

            _sheet.ClearComments(); //清除所有註解。

            ResetSheetStyle();
        }
예제 #3
0
        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();
        }