博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
English Metric Units and Open XML
阅读量:7239 次
发布时间:2019-06-29

本文共 1006 字,大约阅读时间需要 3 分钟。

English Metric Units and Open XML

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

public class Extent : OpenXmlLeafElement的cx和cy属性

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

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

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);

转载地址:http://yvrfm.baihongyu.com/

你可能感兴趣的文章
Mysql中Group By使用Having语句配合查询(where和having区别)
查看>>
C#连接数据库
查看>>
重定向和管道的区别
查看>>
分层、链式分析、url、联系的长度
查看>>
C++实现ping功能<转>
查看>>
使用matplotlib绘制收入增长模型——线性积累型与指数复利型
查看>>
【Spark】Spark-Redis连接池
查看>>
网络流简介
查看>>
How to fix “HTTP Status Code 505 – HTTP Version Not Supported” error?--转
查看>>
mybatis结合mysql批量操作及查询sql
查看>>
groovy gradle 构建配置
查看>>
Linux时间子系统(十五) clocksource
查看>>
BaseRecyclerViewAdapterHelper使用
查看>>
请说出三种减少页面加载时间的方法。
查看>>
HDU 2036 改革春风吹满地
查看>>
Deepin-快捷方式设置
查看>>
管理Java垃圾回收的五个建议
查看>>
【MySQL】MySQL的索引
查看>>
数数字
查看>>
配置阿里云Docker镜像加速仓库
查看>>