Pārlūkot izejas kodu

- Added parsing of "eastAsia" and "bidi" lang element attributes if "val" is not present

Patch provided by Carko. Thanks
master
MadBoy_cp pirms 13 gadiem
vecāks
revīzija
6a0a9a1017
1 mainītis faili ar 6 papildinājumiem un 8 dzēšanām
  1. 6
    8
      DocX/Formatting.cs

+ 6
- 8
DocX/Formatting.cs Parādīt failu

using System; using System;
using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text;
using System.Xml.Linq; using System.Xml.Linq;
using System.Drawing; using System.Drawing;
using System.Globalization; using System.Globalization;
{ {
switch (option.Name.LocalName) switch (option.Name.LocalName)
{ {
case "lang": formatting.Language = new CultureInfo(option.Attribute(XName.Get("val", DocX.w.NamespaceName)).Value); break;
case "spacing": formatting.Spacing = Double.Parse(option.Attribute(XName.Get("val", DocX.w.NamespaceName)).Value) / 20.0; break;
case "position": formatting.Position = Int32.Parse(option.Attribute(XName.Get("val", DocX.w.NamespaceName)).Value) / 2; break;
case "kern": formatting.Position = Int32.Parse(option.Attribute(XName.Get("val", DocX.w.NamespaceName)).Value) / 2; break;
case "w": formatting.PercentageScale = Int32.Parse(option.Attribute(XName.Get("val", DocX.w.NamespaceName)).Value); break;
case "lang": formatting.Language = new CultureInfo(option.GetAttribute(XName.Get("val", DocX.w.NamespaceName), null) ?? option.GetAttribute(XName.Get("eastAsia", DocX.w.NamespaceName), null) ?? option.GetAttribute(XName.Get("bidi", DocX.w.NamespaceName))); break;
case "spacing": formatting.Spacing = Double.Parse(option.GetAttribute(XName.Get("val", DocX.w.NamespaceName))) / 20.0; break;
case "position": formatting.Position = Int32.Parse(option.GetAttribute(XName.Get("val", DocX.w.NamespaceName))) / 2; break;
case "kern": formatting.Position = Int32.Parse(option.GetAttribute(XName.Get("val", DocX.w.NamespaceName))) / 2; break;
case "w": formatting.PercentageScale = Int32.Parse(option.GetAttribute(XName.Get("val", DocX.w.NamespaceName))); break;
case "rFonts": break; case "rFonts": 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;
if(other.spacing != this.spacing) if(other.spacing != this.spacing)
return -1; return -1;
if(other.language != this.language)
if (!other.language.Equals(this.language))
return -1; return -1;
return 0; return 0;

Notiek ielāde…
Atcelt
Saglabāt