Quellcode durchsuchen

updated following function in formatting.cs

public static Formatting Parse(XElement rPr)
{
}

now it supports fontsize and fontcolor for use with magictext

Patch provided by nepcono
master
MadBoy_cp vor 10 Jahren
Ursprung
Commit
461cabe4c8
1 geänderte Dateien mit 16 neuen und 0 gelöschten Zeilen
  1. 16
    0
      DocX/Formatting.cs

+ 16
- 0
DocX/Formatting.cs Datei anzeigen

@@ -96,6 +96,13 @@ namespace Novacode
formatting.PercentageScale = Int32.Parse(
option.GetAttribute(XName.Get("val", DocX.w.NamespaceName)));
break;
// <w:sz w:val="20"/><w:szCs w:val="20"/>
case "sz":
formatting.Size = Int32.Parse(
option.GetAttribute(XName.Get("val", DocX.w.NamespaceName))) / 2;
break;
case "rFonts":
formatting.FontFamily =
new FontFamily(
@@ -104,6 +111,14 @@ namespace Novacode
option.GetAttribute(XName.Get("hAnsi", DocX.w.NamespaceName), null) ??
option.GetAttribute(XName.Get("eastAsia", DocX.w.NamespaceName)));
break;
case "color" :
try
{
string color = option.GetAttribute(XName.Get("val", DocX.w.NamespaceName));
formatting.FontColor = System.Drawing.ColorTranslator.FromHtml(string.Format("#{0}", color));
}
catch { }
break;
case "vanish": formatting.hidden = true; break;
case "b": formatting.Bold = true; break;
case "i": formatting.Italic = true; break;
@@ -113,6 +128,7 @@ namespace Novacode
}
}
return formatting;
}

Laden…
Abbrechen
Speichern