在阅读过程中,Excel注释会被截断

我在Excel单元格中有很长的评论。

我需要能够阅读这个评论。

Microsoft.Office.Interop.Excel.Comment comment = ws.get_Range(ws.Cells[1, Constants.HIDDEN_DATA_COL], ws.Cells[1, Constants.HIDDEN_DATA_COL]).Comment; if(comment!=null) { Microsoft.Office.Interop.Excel.Characters chars = comment.Shape.TextFrame.Characters(System.Type.Missing, System.Type.Missing); string theText = chars.Text; MessageBox.Show(theText); //**truncated!** } 

我读到,加载字符需要循环,但我应该怎么知道如果我不知道angular色的长度该怎么做?

经过试验和错误,通过实施这个解决scheme:

 bool read = true; string finalText=""; int j = 1; int lengthMax = 200; while(read) { string textnya = comment.Shape.TextFrame.Characters(j, lengthMax).Text; finalText = finalText+textnya; if (textnya.Length < lengthMax) { read = false; } else { j = j + lengthMax; } } MessageBox.show(finalText);