ソースを参照

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 10年前
コミット
461cabe4c8
1個のファイルの変更16行の追加0行の削除
  1. 16
    0
      DocX/Formatting.cs

+ 16
- 0
DocX/Formatting.cs ファイルの表示

@@ -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;
}

読み込み中…
キャンセル
保存