diff --git a/src/main/java/org/olat/core/util/openxml/OpenXMLDocument.java b/src/main/java/org/olat/core/util/openxml/OpenXMLDocument.java
index 45cd6bded18da81f8c381cfc2141733eca24ce8f..4c0e44d0b0e0fe12a9a359ca04bb90c4a3fe0b87 100644
--- a/src/main/java/org/olat/core/util/openxml/OpenXMLDocument.java
+++ b/src/main/java/org/olat/core/util/openxml/OpenXMLDocument.java
@@ -66,6 +66,8 @@ import fmath.conversion.ConvertFromLatexToMathML;
 import fmath.conversion.ConvertFromMathMLToWord;
 
 /**
+ * The page are A4 format, with 2.54cm margins on top, bottom, left and right.
+ * 
  * 
  * Initial date: 04.09.2013<br>
  * @author srosse, stephane.rosse@frentix.com, http://www.frentix.com
@@ -227,7 +229,8 @@ public class OpenXMLDocument {
 </w:sectPr>
  */
 	/**
-	 * Must be done at the end of the document
+	 * Must be done at the end of the document. The unit for the size of the
+	 * page and the margin is in twips or twentieths of a point.
 	 */
 	public void appendPageSettings() {
 		Node lastChild = bodyElement.getLastChild();
@@ -1014,7 +1017,7 @@ public class OpenXMLDocument {
 		} else {
 			id = generateId();
 			Size size = ImageUtils.getImageSize(image);
-			emuSize = OpenXMLUtils.convertPixelToEMUs(size, 72);
+			emuSize = OpenXMLUtils.convertPixelToEMUs(size, 72, 15.9/* cm */);
 			filename = getUniqueFilename(image);
 			fileToImagesMap.put(image, new DocReference(id, filename, emuSize, image));
 		}
diff --git a/src/main/java/org/olat/core/util/openxml/OpenXMLUtils.java b/src/main/java/org/olat/core/util/openxml/OpenXMLUtils.java
index a17ec4ca1f789ecb34e7f5ca4a149ef6dbcbb7ca..7182122602dee94c51cdf25b243685b2b38db795 100644
--- a/src/main/java/org/olat/core/util/openxml/OpenXMLUtils.java
+++ b/src/main/java/org/olat/core/util/openxml/OpenXMLUtils.java
@@ -58,8 +58,9 @@ public class OpenXMLUtils {
 	private static final OLog log = Tracing.createLoggerFor(OpenXMLUtils.class);
 
 	public static final double emusPerInch = 914400.0d;
+	public static final double emusPerCm = 360000.0d;
 	
-	public static final Size convertPixelToEMUs(Size img, int dpi) {
+	public static final Size convertPixelToEMUs2(Size img, int dpi) {
 		int widthPx = img.getWidth();
 		int heightPx = img.getHeight();
 		double horzRezDpi = dpi * 1.0d;
@@ -71,6 +72,25 @@ public class OpenXMLUtils {
 		return new Size((int)widthEmus, (int)heightEmus, 0, 0, true);
 	}
 	
+	public static final Size convertPixelToEMUs(Size img, int dpi, double maxWidthCm) {
+		int widthPx = img.getWidth();
+		int heightPx = img.getHeight();
+		double horzRezDpi = dpi * 1.0d;
+		double vertRezDpi = dpi * 1.0d;
+		
+		double widthEmus = (widthPx / horzRezDpi) * emusPerInch;
+		double heightEmus = (heightPx / vertRezDpi) * emusPerInch;
+
+		double maxWidthEmus = maxWidthCm * emusPerCm;
+		if (widthEmus > maxWidthEmus) {
+			double ratio = heightEmus / widthEmus;
+			widthEmus = maxWidthEmus;
+			heightEmus = widthEmus * ratio;
+		}
+
+		return new Size((int)widthEmus, (int)heightEmus, 0, 0, true);
+	}
+	
 	public static int getSpanAttribute(String name, Attributes attrs) {
 		name = name.toLowerCase();
 		int span = -1;