Bläddra i källkod

correct width/height setting in Picture class

next newid extended on CreatePicture in Paragraph class
SetWidthsPercentage pwidth calculation extended  with * (96 / 72)  to get pixels from points
master
ermoll 9 år sedan
förälder
incheckning
9948f40cea
4 ändrade filer med 20 tillägg och 9 borttagningar
  1. 2
    2
      DocX/Image.cs
  2. 11
    0
      DocX/Paragraph.cs
  3. 6
    6
      DocX/Picture.cs
  4. 1
    1
      DocX/Table.cs

+ 2
- 2
DocX/Image.cs Visa fil

@@ -21,9 +21,9 @@ namespace Novacode
string temp = pr.SourceUri.OriginalString;
string start = temp.Remove(temp.LastIndexOf('/'));
string end = pr.TargetUri.OriginalString;
string full = start + "/" + end;
string full = end.Contains(start) ? end : start + "/" + end;
return(new PackagePartStream(document.package.GetPart(new Uri(full, UriKind.Relative)).GetStream(mode, access)));
return (new PackagePartStream(document.package.GetPart(new Uri(full, UriKind.Relative)).GetStream(mode, access)));
}
/// <summary>

+ 11
- 0
DocX/Paragraph.cs Visa fil

@@ -1669,6 +1669,17 @@ namespace Novacode
existingIds.Add(idAtt.Value);
}
while (existingIds.Contains(newDocPrId.ToString()))
newDocPrId++;
//also loop thru all docPr ids
foreach (var bookmarkId in document.Xml.Descendants(XName.Get("docPr", DocX.wp.NamespaceName)))
{
var idAtt = bookmarkId.Attributes().FirstOrDefault(x => x.Name.LocalName == "id");
if (idAtt != null)
existingIds.Add(idAtt.Value);
}
while (existingIds.Contains(newDocPrId.ToString()))
newDocPrId++;

+ 6
- 6
DocX/Picture.cs Visa fil

@@ -348,11 +348,11 @@ namespace Novacode
get { return cx / EmusInPixel; }
set
{
cx = value;
{
cx = value * EmusInPixel;
foreach (XAttribute a in Xml.Descendants().Attributes(XName.Get("cx")))
a.Value = (cx * EmusInPixel).ToString();
a.Value = (cx).ToString();
}
}
@@ -364,11 +364,11 @@ namespace Novacode
get { return cy / EmusInPixel; }
set
{
cy = value;
{
cy = value * EmusInPixel;
foreach (XAttribute a in Xml.Descendants().Attributes(XName.Get("cy")))
a.Value = (cy * EmusInPixel).ToString();
a.Value = (cy).ToString();
}
}

+ 1
- 1
DocX/Table.cs Visa fil

@@ -219,7 +219,7 @@ namespace Novacode
{
if (totalWidth == null) totalWidth = this.Document.PageWidth - this.Document.MarginLeft - this.Document.MarginRight; // calculate total table width
List<float> widths = new List<float>(widthsPercentage.Length); // empty list, will hold actual width
widthsPercentage.ToList().ForEach(pWidth => { widths.Add(pWidth * totalWidth.Value / 100); }); // convert percentage to actual width for all values in array
widthsPercentage.ToList().ForEach(pWidth => { widths.Add((pWidth * totalWidth.Value / 100) * (96 / 72)); }); // convert percentage to actual width for all values in array
SetWidths(widths.ToArray()); // set actual column width
}

Laddar…
Avbryt
Spara