예제 #1
0
        public void Output(RowMessage message)
        {
            foreach (CellMessage each in message.GetMessages())
            {
                int  row    = _reader.AbsoluteIndex;
                byte column = 0;
                if (_columns.ContainsKey(each.Column))
                {
                    column = _columns[each.Column].AbsoluteIndex;
                }

                int     index      = _sheet.Comments.Add(row, column);
                Comment objComment = _sheet.Comments[index];
                objComment.Note     = each.Message;
                objComment.WidthCM  = 5;
                objComment.HeightCM = 3;

                switch (each.MessageType)
                {
                case MessageType.Correct:
                    _sheet.Cells[row, column].Style = _styles.Correct;
                    break;

                case MessageType.Warning:
                    _sheet.Cells[row, column].Style = _styles.Warning;
                    break;

                case MessageType.Error:
                    _sheet.Cells[row, column].Style = _styles.Error;
                    break;
                }
            }
        }
예제 #2
0
        public void Output(RowMessage message)
        {
            foreach (ValidateColumn each in _columns.Values)
            {
                Cell cell = _target_sheet.Cells[_new_index, each.Index];
                cell.PutValue(_reader.GetValue(each.Name));

                // 2017/8/22 穎驊依據高雄小組專案 [03-05][04+] EXCEL匯入格式可否修正為xlsx也可匯入? 更改為新版 Aspose.Cells_201402 寫法 ,SetStyle()
                //cell.Style = _styles.Normal;

                cell.SetStyle(_styles.Normal);

                _reader.GetCell(each.Name).Formula = "=" + _target_sheet.Name + "!" + cell.Name;
            }

            List <CellMessage> messages = message.GetMessages();

            foreach (CellMessage each in messages)
            {
                int  row    = _new_index;
                byte column = _columns[each.Column].Index;

                int     index      = _target_sheet.Comments.Add(row, column);
                Comment objComment = _target_sheet.Comments[index];
                objComment.Note     = each.Message;
                objComment.WidthCM  = 5;
                objComment.HeightCM = 3;

                switch (each.MessageType)
                {
                case MessageType.Correct:

                    // 2017/8/22 穎驊依據高雄小組專案 [03-05][04+] EXCEL匯入格式可否修正為xlsx也可匯入? 更改為新版 Aspose.Cells_201402 寫法 ,SetStyle()
                    //_target_sheet.Cells[row, column].Style = _styles.Correct;

                    _target_sheet.Cells[row, column].SetStyle(_styles.Correct);
                    break;

                case MessageType.Warning:
                    // 2017/8/22 穎驊依據高雄小組專案 [03-05][04+] EXCEL匯入格式可否修正為xlsx也可匯入? 更改為新版 Aspose.Cells_201402 寫法 ,SetStyle()
                    //_target_sheet.Cells[row, column].Style = _styles.Warning;

                    _target_sheet.Cells[row, column].SetStyle(_styles.Warning);
                    break;

                case MessageType.Error:
                    // 2017/8/22 穎驊依據高雄小組專案 [03-05][04+] EXCEL匯入格式可否修正為xlsx也可匯入? 更改為新版 Aspose.Cells_201402 寫法 ,SetStyle()
                    //_target_sheet.Cells[row, column].Style = _styles.Error;

                    _target_sheet.Cells[row, column].SetStyle(_styles.Error);
                    break;
                }
            }
            _new_index++;
        }
예제 #3
0
        public void Output(RowMessage message)
        {
            foreach (CellMessage each in message.GetMessages())
            {
                int row = _reader.AbsoluteIndex;

                // 2017/8/22 穎驊依據高雄小組專案 [03-05][04+] EXCEL匯入格式可否修正為xlsx也可匯入? 更改為新版 Aspose.Cells_201402 寫法 ,從使用 byte 改為 int
                //byte column = 0;
                int column = 0;
                if (_columns.ContainsKey(each.Column))
                {
                    column = _columns[each.Column].AbsoluteIndex;
                }

                int     index      = _sheet.Comments.Add(row, column);
                Comment objComment = _sheet.Comments[index];
                objComment.Note     = each.Message;
                objComment.WidthCM  = 5;
                objComment.HeightCM = 3;

                switch (each.MessageType)
                {
                case MessageType.Correct:
                    // 2017/8/22 穎驊依據高雄小組專案 [03-05][04+] EXCEL匯入格式可否修正為xlsx也可匯入? 更改為新版 Aspose.Cells_201402 寫法 ,SetStyle()
                    //_sheet.Cells[row, column].Style = _styles.Correct;
                    _sheet.Cells[row, column].SetStyle(_styles.Correct);
                    break;

                case MessageType.Warning:
                    // 2017/8/22 穎驊依據高雄小組專案 [03-05][04+] EXCEL匯入格式可否修正為xlsx也可匯入? 更改為新版 Aspose.Cells_201402 寫法 ,SetStyle()
                    //_sheet.Cells[row, column].Style = _styles.Warning;
                    _sheet.Cells[row, column].SetStyle(_styles.Warning);
                    break;

                case MessageType.Error:
                    // 2017/8/22 穎驊依據高雄小組專案 [03-05][04+] EXCEL匯入格式可否修正為xlsx也可匯入? 更改為新版 Aspose.Cells_201402 寫法 ,SetStyle()
                    _sheet.Cells[row, column].SetStyle(_styles.Error);
                    break;
                }
            }
        }
        public void Output(RowMessage message)
        {
            foreach (ValidateColumn each in _columns.Values)
            {
                Cell cell = _target_sheet.Cells[_new_index, each.Index];
                cell.PutValue(_reader.GetValue(each.Name));
                cell.Style = _styles.Normal;
                _reader.GetCell(each.Name).Formula = "=" + _target_sheet.Name + "!" + cell.Name;
            }

            List <CellMessage> messages = message.GetMessages();

            foreach (CellMessage each in messages)
            {
                int  row    = _new_index;
                byte column = _columns[each.Column].Index;

                int     index      = _target_sheet.Comments.Add(row, column);
                Comment objComment = _target_sheet.Comments[index];
                objComment.Note     = each.Message;
                objComment.WidthCM  = 5;
                objComment.HeightCM = 3;

                switch (each.MessageType)
                {
                case MessageType.Correct:
                    _target_sheet.Cells[row, column].Style = _styles.Correct;
                    break;

                case MessageType.Warning:
                    _target_sheet.Cells[row, column].Style = _styles.Warning;
                    break;

                case MessageType.Error:
                    _target_sheet.Cells[row, column].Style = _styles.Error;
                    break;
                }
            }
            _new_index++;
        }