I was not able to locate version 7.0.0.2 but I did update to v7.0.0.0 and when I ran my code again, the grid lines did not print at all.
Attached is a screenshot demonstrating the result of the following code:
private void InsertData(DataSet analysis, IList<string> worksheetNames, string fileName)
{
Workbook workbook = CreateWorkbook();
workbook.Worksheets.RemoveAt(0);
for (int i = 0; i < analysis.Tables.Count; i++)
{
Worksheet worksheet = workbook.Worksheets.Add(worksheetNames[i]);
Cells cells = worksheet.Cells;
cells.Merge(0, 0, 1, 14);
cells.Merge(1, 0, 1, 14);
Cell titleCell = cells[“A1”];
titleCell.PutValue(“Medicare Advantage Information (Non-Employer)”);
Cell subTitleCell = cells[“A2”];
subTitleCell.PutValue(worksheetNames[i]);
Style style = subTitleCell.GetStyle();
style.HorizontalAlignment = TextAlignmentType.Center;
style.VerticalAlignment = TextAlignmentType.Center;
titleCell.SetStyle(style);
subTitleCell.SetStyle(style);
cells.ImportDataTable(analysis.Tables[i], true, “A3”);
cells.SetColumnWidth(0, 20);
for (int col = 1; col < 14; col++)
{
Cell headerCell = cells[2, col];
Style headerCellStyle = headerCell.GetStyle();
headerCellStyle.IsTextWrapped = true;
headerCell.SetStyle(headerCellStyle);
if (headerCell.StringValue.Length <= 17)
{
cells.SetColumnWidth(col, 11.22);
}
else
{
cells.SetColumnWidth(col, 13.5);
}
if (headerCell.StringValue.Length <= 10)
{
cells.SetColumnWidth(col, 9);
}
}
cells.SetRowHeight(2, 28.8);
PageSetup pageSetup = worksheet.PageSetup;
pageSetup.PrintTitleRows = “$2:$3”;
pageSetup.PaperSize = PaperSizeType.PaperLetterRotated;
pageSetup.Orientation = PageOrientationType.Landscape;
pageSetup.PrintGridlines = true;
pageSetup.FitToPagesTall = (int) Math.Ceiling((decimal)analysis.Tables[i].Rows.Count / 60);
pageSetup.BottomMargin = 1.27;
pageSetup.LeftMargin = 1.27;
pageSetup.RightMargin = 1.27;
pageSetup.TopMargin = 1.27;
pageSetup.FooterMargin = .635;
pageSetup.SetFooter(0, “&D”);
pageSetup.SetFooter(1, “Page &P of &N”);
pageSetup.FirstPageNumber = 1;
}
workbook.Worksheets.ActiveSheetIndex = 0;
string finalFilePath = Path.Combine(_workingDirectory, fileName);
workbook.Save(finalFilePath+".xlsx");
workbook.Save(finalFilePath+".pdf", SaveFormat.Pdf);
}