Spire.XLS is a professional Excel API that enables developers to create, manage, manipulate, convert and print Excel worksheets. Get free and professional technical support for Spire.XLS for .NET, Java, Android, C++, Python.

Wed Oct 06, 2021 2:17 pm

Hello,

It seems the transparency can not be set on a row by any mean.
Here's what I've tried to make a row transparent:
Code: Select all
using (var workbook = new Workbook())
{
    var worksheet = workbook.Worksheets[0];
    CellRange row = worksheet.Rows[0];

    // Below are the "color" lines I've tried independently each time
    row.Style.Color = Color.Transparent; // Row is filled with the white color
    row.Style.Color = Color.FromKnownColor(Color.Transparent); // Row is filled with the white color
    row.Style.Color = Color.Empty; // Row is filled with the white color
    row.Style.Color = Color.FromArgb(0, Color.White); // Row is filled with the white color
    row.Style.Color = Color.FromArgb(0, Color.Transparent); // Row is filled with the white color
    row.Style.Color = Color.FromArgb(0, 0, 0, 0); // Row is filled with the white color

    workbook.SaveToFile(@"C:\your_path\Test.xlsx");
}


Am I doing it wrong? If so, could you please provide me with a solution for making a row transparent (as per default), please?

Thank you.

olefebvre
 
Posts: 13
Joined: Wed May 26, 2021 11:36 am

Wed Oct 06, 2021 2:35 pm

It seems that adding the following line solved my issue by making the row transparent:
Code: Select all
row.Style.FillPattern = ExcelPatternType.None;


However, are the lines from my first post still intended to fill the row with non-transparent white?

olefebvre
 
Posts: 13
Joined: Wed May 26, 2021 11:36 am

Thu Oct 07, 2021 2:46 am

Hello,

Thanks for your inquiry!

Kindly note that the "FillPattern" is used to set the fill pattern of the cell. If you want to set the cell fill color as transparent, please refer to the following code:

Code: Select all
row.Style.Color = Color.FromArgb(255,255,255,255);


Sincerely,
Marcia
E-iceblue support team
User avatar

Marcia.Zhou
 
Posts: 858
Joined: Wed Nov 04, 2020 2:29 am

Thu Oct 07, 2021 7:10 am

Hello,

Thank you for your reply.
However, the row is still filled with white color with your solution. Below is the code:
Code: Select all
using (var workbook = new Workbook())
{
    var worksheet = workbook.Worksheets[0];
    CellRange row = worksheet.Rows[0];
    row.Style.Color = Color.FromArgb(255, 255, 255, 255);
    workbook.SaveToFile(@"C:\your_path\Test.xlsx");
}

olefebvre
 
Posts: 13
Joined: Wed May 26, 2021 11:36 am

Thu Oct 07, 2021 7:48 am

Hello,

Thanks for your reply!

I tested this code with the latest Spire.XLS Pack(Hotfix) Version:11.9.3, and the color of the first row cells is transparent.

In order to see the background color of the cell more clearly, I set a background image to the worksheet. As shown in the screenshot, the first row is transparent, while the second row with a white background color cannot display the background image of the worksheet. Here I have also attached the test code and result document.
Code: Select all
            using (var workbook = new Workbook())
            {
                var worksheet = workbook.Worksheets[0];
                worksheet.PageSetup.BackgoundImage = Image.FromFile(@"K:\127645.jpg") as Bitmap;

                CellRange row = worksheet.Rows[0];
                row.Style.Color = Color.FromArgb(255, 255, 255, 255);   //First Row

                worksheet.Rows[1].Style.Color = Color.White;


                string outputfilepath = "output.xlsx";
                workbook.SaveToFile(outputfilepath, ExcelVersion.Version2013);
                System.Diagnostics.Process.Start(outputfilepath);
            }

backCompare.png
backCompare.png (31.77 KiB) Viewed 2475 times
output.zip
(32.03 KiB) Downloaded 233 times

If you are not using the latest version of Spire.Xls, I suggest you try the latest version. If there are still problems with the latest version, please provide us with the target framework of your project. (e.g. .net framework 4.7.2)

Sincerely,
Marcia
E-iceblue support team
User avatar

Marcia.Zhou
 
Posts: 858
Joined: Wed Nov 04, 2020 2:29 am

Thu Oct 07, 2021 11:05 am

Thanks for your reply.

I just used your code sample and did reproduce the issue again.

Here's the result of the code:
Output code.png
Output code.png (55.57 KiB) Viewed 2470 times

And here's the file itself if you want:
output.zip
(6.81 KiB) Downloaded 207 times


The background image is just a plain green image "Test.png" used for discerning the rows more easily.
I'm using Spire.XLS Pro Edition v11.9.3 with .NET Framework 4.8 in a C# console application.
By the way, my Excel (locale/culture) is set in french.

Feel free to ask me further information if needed.

olefebvre
 
Posts: 13
Joined: Wed May 26, 2021 11:36 am

Fri Oct 08, 2021 2:19 am

Hello,

Thanks for sharing more information!

I made more tests with this code on other computers, and did reproduce your issue. This issue has been submitted to our Dev team with the ticket SPIREXLS-3482 for further investigations.

If there is any update, we will keep you informed. Sorry for the inconvenience caused.

Sincerely,
Marcia
E-iceblue support team
User avatar

Marcia.Zhou
 
Posts: 858
Joined: Wed Nov 04, 2020 2:29 am

Mon Oct 25, 2021 10:26 am

Hello,

Thanks for your patient waiting.

Glad to tell you that we just released Spire.XLS Pack(Hotfix) Version:11.10.4, which fixes the issue of ticket SPIREXLS-3482. Welcome to download the new version from the following links and test with the follow code.

Website link: https://www.e-iceblue.com/Download/down ... t-now.html
NuGet link: https://www.nuget.org/packages/Spire.XLS/11.10.4
Code: Select all
                CellRange row = worksheet.Rows[0];
                row.Style.Color = Color.Transparent; 


Sincerely,
Marcia
E-iceblue support team
User avatar

Marcia.Zhou
 
Posts: 858
Joined: Wed Nov 04, 2020 2:29 am

Mon Nov 08, 2021 1:46 pm

Hello,

I can confirm it is now working with this hotfix.
Thank you.

olefebvre
 
Posts: 13
Joined: Wed May 26, 2021 11:36 am

Tue Nov 09, 2021 8:23 am

Hello,

Glad to hear that your issue has been solved.

If you encounter any issues related to our product in the future, just feel free to contact us.

Have a nice day!

Sincerely,
Marcia
E-iceblue support team
User avatar

Marcia.Zhou
 
Posts: 858
Joined: Wed Nov 04, 2020 2:29 am

Return to Spire.XLS