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;
                }
            }
        }
Beispiel #2
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;
                }
            }
        }