I would like to add comments at one cell, So.. I did:
我想在一个单元格中添加注释,所以..我做了:
...
ExcelPackage package = new ExcelPackage(new MemoryStream());
var ws = package.WorkBook.WorkSheet[1];
ws.Cells[1, 1].AddComment("Lot Price: $12,000", "");
...
package.SaveAs(new FileInfo("fileout.xlsx"));
package.Dispose();
When try open the resulted "fileout.xlsx", it showed a dialog box saying to recover as much as possible... Then the recovered fileout.xlsx displays errors:
当尝试打开结果“fileout.xlsx”时,它显示一个对话框,说尽可能恢复...然后恢复的fileout.xlsx显示错误:
"Removed Part: /xl/comments1.xml part with XML error. (Comments) Load error. Line 5, column 0. Removed Part: /xl/comments5.xml part with XML error. (Comments) Load error. Line 5, column 24."
“删除了部分:带有XML错误的/xl/comments1.xml部分。(注释)加载错误。第5行,第0行。删除部分:/xl/comments5.xml部分出现XML错误。(注释)加载错误。第5行,第24栏。“
It appears that EPPlus produced a wrong format xml when there are comments. I would like to share my solutions for this problem:
当有评论时,似乎EPPlus生成了错误的格式xml。我想分享我对这个问题的解决方案:
I just added a NON-BLANK header line for the comments, such as "REF" here:
我刚为评论添加了一个NON-BLANK标题行,例如“REF”:
ws.Cells[1, 1].AddComment("Lot Price: $12,000", "REF");
I hope someone might be helped by this.
我希望有人可以得到这方面的帮助。
1 个解决方案
#1
1
Some one suggested to post it as answer. Here it is:
有人建议将其作为答案发布。这里是:
The problem disappears if like this: I just added a NON-BLANK header line for the comments, such as "REF" here:
如果是这样,问题就会消失:我刚为评论添加了一个NON-BLANK标题行,例如“REF”:
ws.Cells[1, 1].AddComment("Lot Price: $12,000", "REF");
ws.Cells [1,1] .AddComment(“Lot Price:$ 12,000”,“REF”);
I hope someone might be helped by this.
我希望有人可以得到这方面的帮助。
#1
1
Some one suggested to post it as answer. Here it is:
有人建议将其作为答案发布。这里是:
The problem disappears if like this: I just added a NON-BLANK header line for the comments, such as "REF" here:
如果是这样,问题就会消失:我刚为评论添加了一个NON-BLANK标题行,例如“REF”:
ws.Cells[1, 1].AddComment("Lot Price: $12,000", "REF");
ws.Cells [1,1] .AddComment(“Lot Price:$ 12,000”,“REF”);
I hope someone might be helped by this.
我希望有人可以得到这方面的帮助。