next newid extended on CreatePicture in Paragraph class SetWidthsPercentage pwidth calculation extended with * (96 / 72) to get pixels from pointsmaster
| @@ -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> | |||
| @@ -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++; | |||
| @@ -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(); | |||
| } | |||
| } | |||
| @@ -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 | |||
| } | |||