소스 검색

Bug in Width and Height properties of the Picture class is fixed (9525 EMUs in pixel instead of 4156).

Image class now has FileName property.
master
AndreyKovalenko_cp 15 년 전
부모
커밋
f1919e89ff
2개의 변경된 파일22개의 추가작업 그리고 13개의 파일을 삭제
  1. 11
    0
      DocX/Image.cs
  2. 11
    13
      DocX/Picture.cs

+ 11
- 0
DocX/Image.cs 파일 보기

@@ -81,5 +81,16 @@ namespace Novacode
{
return Paragraph.CreatePicture(document, id, string.Empty, string.Empty);
}
///<summary>
/// Returns the name of the image file.
///</summary>
public string FileName
{
get
{
return Path.GetFileName(this.pr.TargetUri.ToString());
}
}
}
}

+ 11
- 13
DocX/Picture.cs 파일 보기

@@ -13,6 +13,8 @@ namespace Novacode
/// </summary>
public class Picture: DocXElement
{
private const int EmusInPixel = 9525;
internal Dictionary<PackagePart, PackageRelationship> picture_rels;
internal Image img;
@@ -59,14 +61,7 @@ namespace Novacode
where (a != null)
select a.Value
).First();
this.fileName =
(
from e in Xml.Descendants(XName.Get("cNvPr", "http://schemas.openxmlformats.org/drawingml/2006/picture"))
select e.Attribute("name").Value
).First();
this.descr =
(
from e in Xml.Descendants()
@@ -288,7 +283,10 @@ namespace Novacode
///</summary>
public string FileName
{
get { return fileName; }
get
{
return img.FileName;
}
}
/// <summary>
@@ -296,14 +294,14 @@ namespace Novacode
/// </summary>
public int Width
{
get { return cx / 4156; }
get { return cx / EmusInPixel; }
set
{
cx = value;
foreach (XAttribute a in Xml.Descendants().Attributes(XName.Get("cx")))
a.Value = (cx * 4156).ToString();
a.Value = (cx * EmusInPixel).ToString();
}
}
@@ -312,14 +310,14 @@ namespace Novacode
/// </summary>
public int Height
{
get { return cy / 4156; }
get { return cy / EmusInPixel; }
set
{
cy = value;
foreach (XAttribute a in Xml.Descendants().Attributes(XName.Get("cy")))
a.Value = (cy * 4156).ToString();
a.Value = (cy * EmusInPixel).ToString();
}
}

Loading…
취소
저장