jmcnamara / libxlsxwriter

A C library for creating Excel XLSX files.
https://libxlsxwriter.github.io
Other
1.49k stars 332 forks source link

Resetting format #372

Closed algaspar closed 2 years ago

algaspar commented 2 years ago

I had a situation where I wanted to add a second line to some descriptive cells. I did a check as to whether the cell had the extra information, and if it did set the format to wrap.

I am alternating between a colored row and a row that is just formatted with a wrapping format called "title". The logic I have for the formatting looks like this:

if (Desc.empty())

{

    worksheet_write_string(worksheet2, row, 1, tmpStr, justcolor);  //no wrap

}

else

{

    worksheet_write_string(worksheet2, row, 1, tmpStr, title);  // wrapped row 

}

This seems to work and the colored rows that aren't wrapped are fine.

I have identical code where I am writing out rows with no color background. I have tried setting the format to NULL there and to a "justplain" format that just sets the font to the default Colibri. On these rows with no color, once one row is set to wrap all of the following rows without color wrap as well. This means that even rows without the additional description stay wide.

Do I need to make my "justplain" format set a color (white) rather than the font? Is there a better way? I titled this as "Resetting format" as I just wanted the format to revert to plain/unformatted when there wasn't an extra description; so I thought NULL would work...

Thanks--

Al

jmcnamara commented 2 years ago

It is hard, just from that description, to see what the issue is. Could you add a small complete program that demonstrates the issue.

algaspar commented 2 years ago

Well, I tried making my "justplain" format to be explicitly LXW_COLOR_WHITE, but it didn't help. I'll write something up and post it to you.

Thanks!

jmcnamara commented 2 years ago

You will need to submit a small, complete, compilable example that demonstrates the issue.

jmcnamara commented 2 years ago

Closing due to the lack of a reproducible example.

algaspar commented 2 years ago

Thank you. I will submit this again, if I have a reproducible example. My apologies for not closing it earlier.

--Al

On Mon, Jun 20, 2022, 6:22 PM John McNamara @.***> wrote:

Closed #372 https://github.com/jmcnamara/libxlsxwriter/issues/372 as completed.

— Reply to this email directly, view it on GitHub https://github.com/jmcnamara/libxlsxwriter/issues/372#event-6842560093, or unsubscribe https://github.com/notifications/unsubscribe-auth/ALF36ELW4JMADPBWIANF3UTVQD4KFANCNFSM5VVJFI2Q . You are receiving this because you authored the thread.Message ID: @.***>