With this:
using Excel = Microsoft.Office.Interop.Excel;
I'm opening the excel and after I'm setting the color of the first cell to transparent like this:
xlRange = xlWorkSheet.get_Range("A1");
xlRange.Interior.Color = System.Drawing.Color.Transparent;
The problem is that it puts white and the "borders" disappear. I want to put the "No Fill" option and it's not working.
I've also tried this:
xlRange.Interior.Color = System.Drawing.Color.Empty;
but then it changed the cell color to black.
How can I solve this?
On the Home tab, in the Font group, click the arrow next to Fill Color, and then click No Fill.
The no fill shortcut is a simple keyboard shortcut that allows you to quickly fill a cell with data without using the fill handle. To use the no fill shortcut, simply select the cell you want to fill and press the Ctrl+Shift+F keys on your keyboard. That's it!
Right-click and then select "Format Cells" from the popup menu. When the Format Cells window appears, select the Fill tab. Next choose the color that you wish to use as the background color or you can choose "No color" to return the cell back to its default transparency.
Assuming that you want to achieve the same state as a cell's initial state (in a new worksheet), use this:
xlRange.Interior.ColorIndex = 0;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With