@Adhirath
Thank you for your feedback. We will further study and solve your issue. We will notify you promptly once there are any updates.
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)
Code:
ImageOrPrintOptions imgOptions = new ImageOrPrintOptions
{
OnePagePerSheet = true,
ImageType = ImageType.Png,
HorizontalResolution = 400,
VerticalResolution = 400,
PrintingPage = PrintingPageType.IgnoreBlank,
GridlineType = GridlineType.Hair,
GridlineColor = Color.Gray,
};
Please let us know your feedback.
just what I wanted guys. You will add this feature or it already exists?
Also what all do i need to do in the page setup then?
We will add this feature to our upcoming release.
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.
so i leave out gridline color in pagesetup?
Yes, if you do not render to Excel file and only rendering to image, you may leave gridline color setting in PageSetup.
@Adhirath
The issues you have found earlier (filed as CELLSNET-58026) have been fixed in this update.
Thank you soo much !
@Adhirath
Thank you for your feedback. You are welcome. If you have any questions, please feel free to contact us at any time.
also forgot to ask, how do I use it?
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,
};
PageSetup-
worksheet.AutoFitRows();
worksheet.PageSetup.PrintArea = printArea;
worksheet.PageSetup.LeftMargin = 0;
worksheet.PageSetup.RightMargin = 0;
worksheet.PageSetup.TopMargin = 0;
worksheet.PageSetup.BottomMargin = 0;
Please add the following code to enable to print gridline:
worksheet.PageSetup.PrintGridlines = true;
Thanks guys, it’s working now. Really amazing support!
You are welcome. We are glad to hear that adding the suggested line of code resolved your issue. Please don’t hesitate to reach out to us at any time if you have additional questions or feedback.