Copying shapes from Office applications results in weird artifacts
- The old "bug":
- New issue
- Investigation
- Workaround
- What can be done to address this issue?
- Further links:
- Misc
The old "bug":
I investigated the given issue. The reason for above behavior is that in Inkscape 0.92.4, the object was pasted as a whole image, but in new Inkscape (tested 1.0aplha1 onward), it is pasted in the form of its component shapes. So, rather than being a bug, it's a new feature with some issues to resolve/document.
New issue
On copy-pasting objects from office applications, the source objects break down in a plethora of ways (although not randomly, but specific to source object's property). Separation of fill and stroke into two distinct objects being one of the examples (the zeroth case in the table).
Investigation
To study diifferent cases conveniently, I made isolated samples1 in Ppt and LibreImpress, and tried copy-pasting2 them in Inkscape.
Following are my observations:
With MS PowerPoint 2007:
Behaviours list: Addition of ghost object(s), breaking into multiple extra objects, loss of color info, color dithering and so on. **Observations differ hugely with office 2016 for many of properties, and therefore maybe with other versions too. This table doesn't consider them & contains only 2007 related info.
Click me to collapse/fold detailed and more precise tabular observations.
Shape | Color/characteristic | Observations on pasting3 | Comment |
---|---|---|---|
Fill + Line | 0. Solid + Solid | - Fill & Stroke Separated. | - See: Stroke to Path |
Fill / Line only1 | 1. Solid without alpha | - Stroke to path (fill) conversion. - Rest okay. |
- Sample attached. - W1 applies. |
2. Solid with Alpha | - Alpha changed to pattern (named like EMFimage0_ref) - 2 solid filled boxes4 added. i.e. Broken in 3 parts. |
- Sample attached. - W1 for fill, W2 for stroke. |
|
3. Gradient without alpha | - No color info at all (probably lost, or incompatible). - 1 extra (clipped/masked) image/ghost object added. i.e. Broken in 2 parts. |
- Exporting as EMF behaves different, similar to original shape, but much more fragmented. - W3 applies after much finicking. |
|
4. Gradient with alpha | - 2 extra (clipped/masked) image objects .... (rest is same as above) i.e. Broken in 3parts. |
- Same as above. - Sample attached. |
With LibreOffice Impress:
Behaviours list: Strokes broken into segments & alpha lost. Breaking into extra objects not so common if gradients not involved. Gradient is problematic probably due to the way libreOffice interpolates them.
Click me to collapse/fold detailed and more precise tabular observations.
Shape | Color/characteristics | Observations3 on pasting | Reason/Comment |
---|---|---|---|
Fill + Line | 0. Solid + Solid | - Fill & Stroke Separated. | - See: Stroke to Path |
Fill / Line only1 | 1. Solid without alpha | - Stroke broken into straight segments (which are fill objects & not strokes). | - Sample attached. - W1 applies. |
2. Alpha | - Alpha info is lost and set to default value (i.e. 100 which means no transparency). - Same for any available case i.e. for line, fill, as well as gradient too. - Unlike with ppt, no extra objects added. |
- W1 for fill, W2 for stroke. | |
Fill only ∵Not Available for line |
3/4. Gradient | - Broken in individual pieces/shades. | - LibreImpress interpolates gradient in steps. - Sample attached. - W2 applies (even gradient is conserved, though with a small quirk). |
Samples:
Click me to collapse/fold.
Shape types ➜ Source Test Files ↴ |
1. Solid Line | 2. Solid with alpha | 4. Gradient | Other |
---|---|---|---|---|
MS_Shapes_test.pptx |
(∴ invisible). Exported_Gradi.emf |
Thumbnail preview for type 4 was shown in the explorer5: ![]() |
||
Impress_Shapes_test.odp | Not Relavant |
|
||
EMF to SVG (via LibreDraw) |
Workaround
graph LR;
PPt-->|EMF|LibreDraw-->|export as SVG|Inkscape;
LibreImpress-->|export as SVG|Inkscape;
Levels of effectivesness:
W1 i.e. fixed the issue to easily manageable stage. (best)
W2 i.e. simulates the original via masking.
W3 i.e. simulates the original via clipping & dithering. (worst)
More combinations here. Keep in mind that it is still a workaround
Also: From Office 2019, u can export things as svg and even paste directly as svgs. See "Use SVGs from Office across 3rd party apps" and "September 2019" relesase: https://web.archive.org/web/20210313183903/https://support.microsoft.com/en-us/office/what-s-new-in-powerpoint-for-microsoft-365-e8ef980c-5b12-4fff-ae3f-0819e6a21a1f
What can be done to address this issue?
The suggested workaround can be automated within Inkscape, maybe in the form of an import EMF dialog. This can be done using the code from LibreImpress. This & other relevant info given here should be documented somewhere officially for future users.
Further links:
- caltech's emf's investigation & my workaround initials: comment 252758565
- Workaround trials - detailed: comment 273422969
- Libre Office's Filters (used in workaround): comment 273461826
- EMF technical info related: comment 282521206
- Can VML be the secret souce: comment 344664118
- EMF test corpus by Andreas Beeker (kiwiwings) : comment 284995801
Misc
Software Version and Operating System:
- Inkscape Version: 1.0beta1 (fe3e306, 2019-09-17)
- LibreOffice Version: 6.3.0.4 (x64) Build ID/ See log: 057fc023c990d676a43019934386b85b21a9ee99
- Microsoft Office PowerPoint 2007 (12.0.4518.1014) (MSO is same as the number in braces)
- Operating System: Windows 10
- Operating System version: 1903
P.S.
Feel free to ask for any related info. And also to do your own further research too
Footnotes
-
isolated samples
: as already said, the pasted shape is broken into its stroke and fill. Those are then further broken further depending on their properties. So isolating stroke and fill helps to reduce the number of different cases. Isolation can be done by using either of themonly
i.e. setting the other thing to none in office applications. When other is given some property other than none, then the effects combine. This is also said in footnote 3.↩ ↩ 2↩ 3 -
copy-pasting
: After various testing, it's observed that for simple objects [i.e. without gradients], the behavior of doing it via emf is more or less same as copy-pasting. Mostly differences regarding Clipping/masking are seen. Although major differences regarding breaking is spotted with gradients.↩ -
[In 1st obs. table] down the table, observations from previous applicable cases also apply unless stated otherwise i.e. only 'new' behavior is given, and old behavior is not repeated again for sake of convenience.
↩ ↩ 2 -
[in the obs. tables] I guess these were bounding boxes.
↩ -
[in the samples table] Thumbnail preview shown using the extension "SVG Explorer Extension dssee from Dotz Software" for windows displays the bounding box with correct gradient.
↩