When adding a new XSSFComment using the following code
```
IDrawing patr = sheet.CreateDrawingPatriarch();
var anchor = NPOIHelper.CreateAnchor(sheet.Workbook, 0, 0, 0, 0, 0, 0, 4, 4);
anchor.AnchorType = AnchorType.DontMoveAndResize;
IComment comment = patr.CreateCellComment(anchor);
comment.String = new XSSFRichTextString(commentVal);
comment.Author = "";
NPOIHelper.FormatComment(sheet, comment);
row.GetCell(colIndex, MissingCellPolicy.CREATE_NULL_AS_BLANK).CellComment = comment;
```
Two things happen.
1. On all versions of excel, if you open excel and save the document then reopen, the comment turns into a arrow as it seems to become a two cell anchored comment.
2. On versions of excel <= 2010, the background of the cell is blank
This appears to be because of two extra elements in the v:shapetype element in the VML diagram. If stroked="f" filled="f" are present these issues occur. If they are not there, everything works fine. There's no way I can tell in the API to remove these, but I think by default they should be omitted from the VML.
I've implemented a hack to work around it using reflection
```
BindingFlags bindFlags = BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static;
XSSFSheet xssfSheet = (XSSFSheet)sheet;
MethodInfo methodInfo = xssfSheet.GetType().GetMethod("GetVMLDrawing", bindFlags);
XSSFVMLDrawing vmlDrawing = (XSSFVMLDrawing)methodInfo.Invoke(xssfSheet, new object[] { false });
MethodInfo methodInfo2 = vmlDrawing.GetType().GetMethod("GetItems", bindFlags);
ArrayList arrayList = (ArrayList)methodInfo2.Invoke(vmlDrawing, new object[] { });
foreach (var obj in arrayList)
{
if (obj is CT_Shapetype)
{
var shapeType = (CT_Shapetype)obj;
shapeType.filled = ST_TrueFalse.@true;
shapeType.stroked = ST_TrueFalse.@true;
}
}
```
Very dirty but it resolves the problem.
Thanks!
```
IDrawing patr = sheet.CreateDrawingPatriarch();
var anchor = NPOIHelper.CreateAnchor(sheet.Workbook, 0, 0, 0, 0, 0, 0, 4, 4);
anchor.AnchorType = AnchorType.DontMoveAndResize;
IComment comment = patr.CreateCellComment(anchor);
comment.String = new XSSFRichTextString(commentVal);
comment.Author = "";
NPOIHelper.FormatComment(sheet, comment);
row.GetCell(colIndex, MissingCellPolicy.CREATE_NULL_AS_BLANK).CellComment = comment;
```
Two things happen.
1. On all versions of excel, if you open excel and save the document then reopen, the comment turns into a arrow as it seems to become a two cell anchored comment.
2. On versions of excel <= 2010, the background of the cell is blank
This appears to be because of two extra elements in the v:shapetype element in the VML diagram. If stroked="f" filled="f" are present these issues occur. If they are not there, everything works fine. There's no way I can tell in the API to remove these, but I think by default they should be omitted from the VML.
I've implemented a hack to work around it using reflection
```
BindingFlags bindFlags = BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static;
XSSFSheet xssfSheet = (XSSFSheet)sheet;
MethodInfo methodInfo = xssfSheet.GetType().GetMethod("GetVMLDrawing", bindFlags);
XSSFVMLDrawing vmlDrawing = (XSSFVMLDrawing)methodInfo.Invoke(xssfSheet, new object[] { false });
MethodInfo methodInfo2 = vmlDrawing.GetType().GetMethod("GetItems", bindFlags);
ArrayList arrayList = (ArrayList)methodInfo2.Invoke(vmlDrawing, new object[] { });
foreach (var obj in arrayList)
{
if (obj is CT_Shapetype)
{
var shapeType = (CT_Shapetype)obj;
shapeType.filled = ST_TrueFalse.@true;
shapeType.stroked = ST_TrueFalse.@true;
}
}
```
Very dirty but it resolves the problem.
Thanks!