none
OpenXml AddImagePart set EMU RRS feed

  • Question

  • Hi ppl.

    How to get EMUs (English Metric Units) from a image? I try:

     Int64[] medidas = new Int64[2];
          using (System.Drawing.Image objImage = System.Drawing.Image.FromFile(imageSrc))
          {
            Int64 largura = Convert.ToInt64((objImage.Width / objImage.HorizontalResolution) * 514350);
            Int64 altura = Convert.ToInt64((objImage.Height / objImage.VerticalResolution) * 514350);
            medidas[0] = largura;
            medidas[1] = altura;
          }
    

    but don´t work well. I all microsoft examples to addImagePart in Document have static dimisions like:

     Wp.Extent extent1 = new Wp.Extent() { Cx = 6645910L, Cy = 2143760L };
    


    but... this dimisions don´t work for all pictures! i need dimisions dynamics like ms word when you open a image.

    Any sugestions?

     

    Best regards :)

    Wednesday, July 27, 2011 4:11 PM

Answers