Size of ODG (inserted via OLE) in ODT

LibreOffice 4.1.2.3

I am trying to insert an ODG into a ODT using Insert → Object → OLE Object → Create from file

The “physical size” on the page (paper) of the object in the ODT is NOT the same as the original ODG ! Of course grabbing a resize handle in Writer “stretches” the contents out of shape.

Example 1, the ODG is 1 page which is defined as 6.0"x2.0" with 0,0,0,0 margins. When it is inserted it is clearly much taller than 2.0".

Example 2, the ODG is 1 page, A4 size with A4 default margins. When I try to insert it into my ODT it fills the width of the Letter size page, but the length is much too small.

In both case the image contents has the proper width/height ratio.

OLE has long had problems under OOo/LO and will likely continue to do so as it is a proprietary technology that limits interoperability (refer Wikipedia and MS Developer Network OLE Data Structures pages). Bug fdo#65321 would appear to be the particular issue you are experiencing (i.e., canvas size). Admittedly that bug does not contain much in the way of technical detail, but it does relate to the problem you are experiencing. The discussion in this thread touches on the same subject.

I have redone the examples below for greater clarity as the current calculations for determining OLE object size are more complex than I first realised. While it appears that the size of an object inserted via OLE is “arbitrary,” it is actually calculated. The main factors are the width, height, and aspect ratio of the canvas of the ODG being inserted and the width of the page of the ODT being inserted into. In all cases there is a maximum dimension of the width of the page being inserted into and a height of 406.86pt / 5.65in / 143.53mm. Once either of these dimensions is reached the graphic will begin to rescale in order to fit within the available area.

Square canvas

Where the aspect ratio (width vs. height) of the canvas is square an object inserted via OLE will have a width of ~150% and a height of ~103% of the canvas in the original ODG.

In all these examples the diagram is 150x150pt / 2.08x2.08in / 52.92x52.92mm and placed on canvases of varying size as indicated. Position of the diagram is top left as the canvas increases in size. The page size shown is A4: a width of 595.3pt / 8.27in / 210mm with default left and right margins of 57pt / 0.79in / 20.1mm, giving a default text block width of 481.3pt / 6.69in / 169.84mm.

150x150pt / 2.08x2.08in / 52.92x52.92mm:

300x300pt / 4.17x4.17in / 105.83x105.83mm:

395x395pt / 5.49x5.49in / 139.35x139.35mm:

500x500pt / 6.94x6.94in / 176.39x176.39mm:

595.3x841.89pt / 8.27x11.69in / 210.00x297.00mm (i.e., A4):

Portrait canvas

Where the aspect ratio (width vs. height) of the canvas is portrait an object inserted via OLE will have a width of ~300% and a height of ~103% of the canvas in the original ODG. Some example figures for an ODG with 0pt margins all around are:

  • ODG 75x150pt displays as 226.20x154.60pt (301.60x103.07%).
  • ODG 150x300pt displays as 453.40x309.90pt (302.27x103.30%).
  • ODG 200x400pt displays as 595.25x406.85pt (297.63x101.71%) i.e., the maximum width (A4) and height (limit) has been reached.

Landscape canvas

Where the aspect ratio (width vs. height) of the canvas is landscape an object inserted via OLE will have a width of ~103% and a height of ~140% of the canvas in the original ODG. Some example figures for an ODG with 0pt margins all around are:

  • ODG 150x75pt displays as 154.40x105.50pt (102.93x140.67%).
  • ODG 300x150pt displays as 308.85x211.05pt (102.95x141.30%).
  • ODG 400x200pt displays as 412.20x281.70pt (103.05x140.85%).
  • ODG 500x250pt displays as 516.85x353.25pt (103.37x141.30%).
  • ODG 600x300pt displays as 595.25x406.85pt (99.21x135.62%) i.e., the maximum width (A4) and height (limit) has been reached.

Calculations

From this it can be calculated that the largest size ODG canvas that will fit onto an A4 page, without being re-scaled, is approximately:

  • Square: 395x395pt / 5.49x5.49in / 139.35x139.35mm.
  • Portrait: 195x390pt / 2.71x5.42in / 68.79x137.59mm.
  • Landscape: 570x285pt / 7.92x3.96in / 201.08x100.54mm.

To calculate the maximum dimension (width of page or height of 406.85pt) simply divide by the multiplying percentage i.e., for 140% divide by 1.4 (or 1.41 to give a margin of error). The multiplying factors mean however that objects inserted via OLE can usually not be positioned close to other content due to the increased space included in the frame.

No this is different This has nothing to do with the “canvas”.

Writer seems to “arbitrarily” pick a size on the page where the ODG file is going to be pasted that is different than the size of the “paper” as it is defined in the ODG.

@theoldwizard1, it does relate to the canvas, it is just that the relationship is not an obvious one. I will update my answer for greater clarity.

Thanks for the update and images, bur I an still struggling.

My ODG is defined to have a Page Size of 6.0x2.0 inches with zero, zero, zero, zero margins. I am inserting into a blank “Letter” size (8.5x11.0") Writer page with 0.25, 0.25, 0.25, 0.25 margins. When I Insert → Object → OLE Object → Create from file the resultant OLE is 6.19x3.12 inches (from Right Click, Object, Type) so it was scaled 103% (width) and 156% (height). How do you get a 6.0x2.0 OLE ?

Thanks for the update. The problem is the 6.0in width of the ODG. This width will become ~150% on insert using OLE. The ODG needs to be scaled smaller to fit within the margins. Page width of 8.5in and left/right margins of 0.25in means a text block width of 8.0in. Dividing by 1.5 gives 5.33in, but you should reduce this (perhaps to 5.16in) to ensure the ODG will fit within the margins OK. Try testing with an ODG around that size to see what happens.

I AM SO CONFUSED !!

I shrunk the object in Draw to 5.0x1.5, both the actual image and the canvas (Page Setup size). Now when I Insert → Object → OLE Object → Create from file, whil in Draw the resultant OLE is 6.9x5.8 and the image, of course, is actually smaller !

Can you upload the ODG (or an example file the same size) somewhere and provide a link here? I found your examples here. It appears the resizing algorithm depends on the height and width of the canvas and scales differently for portrait, square, and landscape. I will update my answer. Thanks for bringing this to my attention.