Skip to content

Commit 28e9888

Browse files
authored
LT-22473: Word Export: Fix bold and italic problem
When bold or italic were explicitly set to false for a style, but a parent node was using a style where it was explicitly set to true, then we were setting the value to true. This change corrects the logic error and uses any value explicitly set for a node (false or true) to override a value explicitly set for a parent node.
1 parent 36947db commit 28e9888

1 file changed

Lines changed: 6 additions & 8 deletions

File tree

Src/xWorks/WordStylesGenerator.cs

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -513,11 +513,10 @@ private static StyleRunProperties AddFontInfoWordStyles(BaseStyleInfo projectSty
513513

514514
// Check for bold
515515
bool bold;
516-
GetFontValue(wsFontInfo.m_bold, defaultFontInfo.Bold, out bold);
517-
if (bold)
516+
if (GetFontValue(wsFontInfo.m_bold, defaultFontInfo.Bold, out bold))
518517
{
519-
var boldFont = new Bold() { Val = true };
520-
var boldCS = new BoldComplexScript() { Val = true };
518+
var boldFont = new Bold() { Val = bold };
519+
var boldCS = new BoldComplexScript() { Val = bold };
521520
charDefaults.RemoveAllChildren<Bold>();
522521
charDefaults.RemoveAllChildren<BoldComplexScript>();
523522
charDefaults.Append(boldFont);
@@ -526,11 +525,10 @@ private static StyleRunProperties AddFontInfoWordStyles(BaseStyleInfo projectSty
526525

527526
// Check for italic
528527
bool ital;
529-
GetFontValue(wsFontInfo.m_italic, defaultFontInfo.Italic, out ital);
530-
if (ital)
528+
if (GetFontValue(wsFontInfo.m_italic, defaultFontInfo.Italic, out ital))
531529
{
532-
var italFont = new Italic() { Val = true };
533-
var italicCS = new ItalicComplexScript() { Val = true };
530+
var italFont = new Italic() { Val = ital };
531+
var italicCS = new ItalicComplexScript() { Val = ital };
534532
charDefaults.RemoveAllChildren<Italic>();
535533
charDefaults.RemoveAllChildren<ItalicComplexScript>();
536534
charDefaults.Append(italFont);

0 commit comments

Comments
 (0)