English Metric Units and Open XML

在Open XML里使用了English Metric Units(EMUs)来作为度量单位。比如

public class Extent : OpenXmlLeafElement的cx和cy属性

<wp:extent cx="1828800" cy="1828800"/>

MSDN的解释:The cx attributes specifies that this object has a height of 1828800 EMUs (English Metric Units),并没给出具体的解释。

wikipedia里关于Office_Open_Xml里关于DrawingML里面对EMUs有一段定义

http://en.wikipedia.org/wiki/Office_Open_XML_file_formats#DrawingML

A DrawingML graphic's dimensions are specified in English Metric Units (EMUs). It is so called because it allows an exact common representation of dimensions originally in either English or Metric units. This unit is defined as 1/360,000 of a centimeter and thus there are 914,400 EMUs per inch, and 12,700 EMUs per point.

1EMUs= 1/914400英寸

而我们在计算的时候,通常得到的是图片的像素,根据图片分辨率的不同,每一寸上的像素点事不同的。

所以 EMUS=像素*1914400/分辨率

代码如下

Bitmap bm = new Bitmap("image.jpg");
DocumentFormat.OpenXml.Drawing.Extents extents = new DocumentFormat.OpenXml.Drawing.Extents();
extents.Cx = (long)bm.Width * (long)((float)914400 / bm.HorizontalResolution);
extents.Cy = (long)bm.Height * (long)((float)914400 / bm.VerticalResolution);

English Metric Units and Open XML的更多相关文章

  1. python提取xml属性导入Mysql

    xml文档来自ganglia-gmond端telnet localhost 8649产生出来的文档,由于ganglia每隔一段时间就更新数据,为了永久保存数据到MySQL中,就用python写了最开始 ...

  2. Java中XML的四种解析方式(一)

    XML是一种通用的数据交换格式,它的平台无关性.语言无关性.系统无关性给数据集成与交互带来了极大的方便.XML在不同的语言环境中解析的方式都是一样的,只不过实现的语法不同而已. XML文档以层级标签的 ...

  3. Arcgis Javascript API 开发笔记

    JS API3.4的要求 à(1)  IE9或以上版本 否则dijit1.8.3不匹配 1.如何发布ArcgisJavascript API应用 0.准备工作: (1).有web应用: (2).有js ...

  4. NPOI创建DOCX常用操作【转】

    1.  创建文档 XWPFDocument m_Docx = new XWPFDocument();2.  页面设置 //1‘=1440twip=25.4mm=72pt(磅point)=96px(像素 ...

  5. C#采用OpenXml给word里面插入图片

    using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Threa ...

  6. NPOI创建DOCX常用操作

    1.  创建文档 XWPFDocument m_Docx = new XWPFDocument(); 2.  页面设置 //1‘=1440twip=25.4mm=72pt(磅point)=96px(像 ...

  7. 使用openxml提取word中的文本和图片并转为Html

    使用openxml提取word中的文本和图片 使用 openXml 提取 word 中的 Text 和 Drawing 使用 openXml 将 word 中的文本和图片转为Html 使用 openX ...

  8. [转] PHP计算两个坐标之间的距离, Calculate the Distance Between Two Points in PHP

    Calculate the Distance Between Two Points in PHP There are a lot of applications where it is useful ...

  9. python核心编程第六章练习6-8

    6-8.列表.给出一个整型值,返回代表该值得英文,比如输入89会返回“eight-nine”.附加题:能够返回符合英文语法规律的新式,比如输入89会返回“eighty-nine”.本练习中的值假定在0 ...

随机推荐

  1. 设计模式之美:Creational Patterns(创建型模式)

    创建型模式(Creational Patterns)抽象了对象实例化过程. 它们帮助一个系统独立于如何创建.组合和表示它的那些对象. 一个类创建型模式使用继承改变被实例化的类. 一个对象创建型模式将实 ...

  2. C语言 稀疏矩阵 压缩 实现

    稀疏矩阵压缩存储的C语言实现 (GCC编译). /** * @brief C语言 稀疏矩阵 压缩 实现 * @author wid * @date 2013-11-04 * * @note 若代码存在 ...

  3. Server Develop (九) Simple Web Server

    Simple Web Server web服务器hello world!-----简单的socket通信实现. HTTP HTTP是Web浏览器与Web服务器之间通信的标准协议,HTTP指明了客户端如 ...

  4. jenkins2 pipeline插件的10个最佳实践

    jenkins pipeline的10个最佳实践. 文章来自:http://www.ciandcd.com文中的代码来自可以从github下载: https://github.com/ciandcd ...

  5. [BTS] WCF-SAP adapter

    =================================== Exception has been thrown by the target of an invocation. (mscor ...

  6. 【Oracle】Oracle锁表处理

    问题分析(1)锁的分析ORACLE里锁有以下几种模式:0:none1:null 空2:Row-S 行共享(RS):共享表锁,sub share3:Row-X 行独占(RX):用于行的修改,sub ex ...

  7. paip.语义分析--单字动词表.txt

    paip.语义分析--单字动词表.txt 排除重复  select * from t where word in (SELECT word from t_a)  or   word in (SELEC ...

  8. Atitit.研发管理---TOGAF架构跟 (ADM开发方法)总结

    Atitit.研发管理---TOGAF架构跟 (ADM开发方法)总结 1. TOGAF是在过去二十年间出现的企业架构框架 1 2. TOGAF内容结构 1 3. TOGAF 实现过程 2 4. 参考 ...

  9. python星号变量

    python 元组 tupletup1 = ('physics', 'chemistry', 1998, 2000)tup2 = (1, 2, 3, 4, 5)tup3 = 'a', 'b', 'c' ...

  10. 编写西游记人物类(XiYouJiRenWu)

    package java1; public class XiYouJiRenWu { double height; String name; String weapon; void printName ...