Explorar el Código

get/set image size (inches) helper

master
Lorenzo Delana hace 9 años
padre
commit
ff4c29eb87
Se han modificado 1 ficheros con 38 adiciones y 2 borrados
  1. 38
    2
      DocX/Picture.cs

+ 38
- 2
DocX/Picture.cs Ver fichero

{ {
return img.FileName; return img.FileName;
} }
}
}
/// <summary> /// <summary>
/// Get or sets the Width of this Image. /// Get or sets the Width of this Image.
} }
} }
// refs:
// https://startbigthinksmall.wordpress.com/2010/01/04/points-inches-and-emus-measuring-units-in-office-open-xml/
// http://lcorneliussen.de/raw/dashboards/ooxml/
private const int InchToEmuFactor = 914400;
private const double EmuToInchFactor = 1d / InchToEmuFactor;
/// <summary>
/// Get or sets the Width of this Image (inches).
/// </summary>
public double WidthInches
{
get
{
return Width * EmusInPixel * EmuToInchFactor;
}
set
{
Width = (int)(value * InchToEmuFactor / EmusInPixel);
}
}
/// <summary>
/// Get or sets the Height of this Image (inches).
/// </summary>
public double HeightInches
{
get
{
return Height * EmusInPixel * EmuToInchFactor;
}
set
{
Height = (int)(value * InchToEmuFactor / EmusInPixel);
}
}
//public void Delete() //public void Delete()
//{ //{
// // Remove xml // // Remove xml
// i.Remove(); // i.Remove();
// // Rebuild the image collection for this paragraph // // Rebuild the image collection for this paragraph
// // Requires that every Image have a link to its paragraph // // Requires that every Image have a link to its paragraph

Cargando…
Cancelar
Guardar