I have provided the entire code for generating the image above, the table is present in this file- tableexcel.zip (12.2 KB), this did not use to happen with 24.7.0 version started happening when i moved to 25.4.0
We can see the color of border which is automatic color is changed to be same color as grildline after setting worksheet.GridlineColor = System.Drawing.Color.Gray; . In Excel, after changing the color of gridline, the color of border set in cell is also changed.
The gridline is solid after setting GridlineType = GridlineType.Hair, which is OK.
Do you want only the color of gridline is changed to the set color, while keeping the color of border set in Cells as it is?
We decide to add new API ImageOrPrintOptions.GridlineColor to set grildline color during rendering. It will ignore the grildline color settings in the source file.
Please check the result with prefix(setting ImageOrPrintOptions.GridlineColor to Color.Gray. CELLSNET-58026_prefix.zip (95.5 KB)
You may use the same code as you do previously for PageSetup. However, kindly note that when you apply ImageOrPrintOptions.GridlineColor, it will override your existing settings related to gridline color when rendering the worksheet to an image.
Please refer to the sample code provided by @peyton.xu earlier. I hope your issue can be resolved. If you still have any questions, please feel free to contact us at any time.
Hi guys I have been trying to get it to work. I have added the GridlineColor property as well. But I do not see any gridlines being added. I tried creating a table without any formatting and am not getting any gridlines on it. Do I have to change any other properties? I am using the following code for setting the image options-
ImageOrPrintOptions imgOptions = new ImageOrPrintOptions
{
OnePagePerSheet = true,
ImageType = ImageType.Png,
HorizontalResolution = 400,
VerticalResolution = 400,
PrintingPage = PrintingPageType.IgnoreBlank,
GridlineType = GridlineType.Hair,
GridlineColor = Color.Gray,
};
Sets consent for sending user data to Google for online advertising purposes.
Sets consent for personalized advertising.
Cookie Notice
To provide you with the best experience, we use cookies for personalization, analytics, and ads. By using our site, you agree to our cookie policy.
More info
Enables storage, such as cookies, related to analytics.
Enables storage, such as cookies, related to advertising.
Sets consent for sending user data to Google for online advertising purposes.
Sets consent for personalized advertising.
Cookie Notice
To provide you with the best experience, we use cookies for personalization, analytics, and ads. By using our site, you agree to our cookie policy.
More info
Enables storage, such as cookies, related to analytics.
Enables storage, such as cookies, related to advertising.
Sets consent for sending user data to Google for online advertising purposes.