ソースを参照

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 ファイルの表示

formatting.PercentageScale = Int32.Parse( formatting.PercentageScale = Int32.Parse(
option.GetAttribute(XName.Get("val", DocX.w.NamespaceName))); option.GetAttribute(XName.Get("val", DocX.w.NamespaceName)));
break; 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": case "rFonts":
formatting.FontFamily = formatting.FontFamily =
new FontFamily( new FontFamily(
option.GetAttribute(XName.Get("hAnsi", DocX.w.NamespaceName), null) ?? option.GetAttribute(XName.Get("hAnsi", DocX.w.NamespaceName), null) ??
option.GetAttribute(XName.Get("eastAsia", DocX.w.NamespaceName))); option.GetAttribute(XName.Get("eastAsia", DocX.w.NamespaceName)));
break; 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 "vanish": formatting.hidden = true; break;
case "b": formatting.Bold = true; break; case "b": formatting.Bold = true; break;
case "i": formatting.Italic = true; break; case "i": formatting.Italic = true; break;
} }
} }
return formatting; return formatting;
} }

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