[GH-ISSUE #372] Resetting format #296

Closed
opened 2026-05-05 12:06:58 -06:00 by gitea-mirror · 5 comments
Owner

Originally created by @algaspar on GitHub (May 11, 2022).
Original GitHub issue: https://github.com/jmcnamara/libxlsxwriter/issues/372

Originally assigned to: @jmcnamara on GitHub.

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

Originally created by @algaspar on GitHub (May 11, 2022). Original GitHub issue: https://github.com/jmcnamara/libxlsxwriter/issues/372 Originally assigned to: @jmcnamara on GitHub. 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: ```C 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
gitea-mirror 2026-05-05 12:06:58 -06:00
Author
Owner

@jmcnamara commented on GitHub (May 11, 2022):

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

<!-- gh-comment-id:1124128164 --> @jmcnamara commented on GitHub (May 11, 2022): It is hard, just from that description, to see what the issue is. Could you add a small complete program that demonstrates the issue.
Author
Owner

@algaspar commented on GitHub (May 11, 2022):

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!

<!-- gh-comment-id:1124149897 --> @algaspar commented on GitHub (May 11, 2022): 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!
Author
Owner

@jmcnamara commented on GitHub (Jun 4, 2022):

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

<!-- gh-comment-id:1146633661 --> @jmcnamara commented on GitHub (Jun 4, 2022): You will need to submit a small, complete, compilable example that demonstrates the issue.
Author
Owner

@jmcnamara commented on GitHub (Jun 20, 2022):

Closing due to the lack of a reproducible example.

<!-- gh-comment-id:1160945253 --> @jmcnamara commented on GitHub (Jun 20, 2022): Closing due to the lack of a reproducible example.
Author
Owner

@algaspar commented on GitHub (Jun 21, 2022):

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:
@.***>

<!-- gh-comment-id:1161630746 --> @algaspar commented on GitHub (Jun 21, 2022): 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: > ***@***.***> >
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: github-starred/libxlsxwriter#296
No description provided.