Bug 147592 - In Writer all inserted linked OLE spreadsheets do share the same view, which is recently opened view in Calc
Summary: In Writer all inserted linked OLE spreadsheets do share the same view, which ...
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
6.4.2.2 release
Hardware: All Windows (All)
: medium enhancement
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: OLE-Objects
  Show dependency treegraph
 
Reported: 2022-02-22 13:24 UTC by tomasz.sztejka@polon-alfa.pl
Modified: 2023-09-11 08:46 UTC (History)
3 users (show)

See Also:
Crash report or crash signature:


Attachments
Attached example documents (13.42 KB, application/octet-stream)
2022-02-24 10:33 UTC, tomasz.sztejka@polon-alfa.pl
Details

Note You need to log in before you can comment on or make changes to this bug.
Description tomasz.sztejka@polon-alfa.pl 2022-02-22 13:24:01 UTC
Description:


If a Calc speadsheet is inserted in Writer as OLE object with "Create from file"->"Link to file" to existing file the view (show columns/rows range and position) is inherited from the Calc file. If the same spreadsheet is inserted in that way multiple times (that is linking to same file) all do show the same range of cells.

Result:
1.Opening Calc sheet and just moving around affects the Writer document referencing it.
2.There is no possibility to show two separate portions of the same spreadsheet in Writer document.

Steps to Reproduce:
1.Create the Calc spreadsheet, fill two separate fragments of it with two data block so that You could see which one is visible and which one is not. Make each block to contain at least two columns.
2.Save it, close.
2.Create a Writer document.
3.Select Insert->Object->OLE Object. Choose "Create From File" and "Libre... Spreadsheet".
4.In dialog "Insert OLE Object" check the box "Link to file" and use search to navigate to the spreadsheet created in point 1.
5.Repeat second time inserting another view of THE SAME file.
6.Activate first view and navigate to FIRST data block. Make at least two columns visible.
7.Activate second view and navigate to SECOND data block. Make at least two columns visible.
8.Save document and close. This may be wise to make a screenshot before closing.

Since that moment effects may vary, but are always following some scheme.

9.Open Writer document. When it asks about updating all links say "No".
10.Observe that both views do show their set up fragments of Calc sheet. This is a correct behavior.

11.Close document without saving.
12.Open Calc inserted sheet.
13.Navigate to FIRST data block and modify first cell of this region. Leave cursor there.
14.Save it and close.

15.Open again Writer document. This time say "Yes" when it ask about updating all links.
16.Observe, that now:
  a) BOTH views of the spreadsheet do show THE SAME data block;
  b) BOTH views are just one column wide.

17.Try it again adding some data below the block.

THIS IS WRONG.






Actual Results:
1.After update both views do show the same fragment.
2.After update what is shown in view seems to calculated from:
  - location of cursor and sheet in which cursor was during save;
  - some auto-ranging selecting what is shown.
 instead of what was visible BEFORE update.

Expected Results:
The view should show exactly the same cells range regardless of any edits in spreadsheet, any other views of the same spreadsheet and any update process.


Reproducible: Always


User Profile Reset: No



Additional Info:
It seems to be inherently related to limitations of OLE technology AND Calc since I:
 a) could not replicate it on Linux where OLE is not used;
 b) could not replicate in on Windows with inserted Writer documents as OLE objects.

This bug is present since many years. I am not sure how far in time, but it may be since before LibreOffice forked from OpenOffice.

I would be pleased to find it somehow fixed (or at least have a good work around).

I wished to use the "multiple views of the same sheet" functionality to be able to create a printable, paged, good looking report template which on one page contains input data and on others some computation results. I was thinking about linking those views to different regions of the same Calc sheet document so the computations could be run in Calc while elementary data could be entered in Writer just in place where the reader reads the "how to do it" text.
Comment 1 m_a_riosv 2022-02-22 22:10:47 UTC
Please, could you attach sample files.
Comment 2 tomasz.sztejka@polon-alfa.pl 2022-02-24 10:33:02 UTC
Created attachment 178501 [details]
Attached example documents

Attached example file.
The "Arkusz.ods" is embedded and linked to "dokument.odt" file.

Thanks for looking at it.
Comment 3 QA Administrators 2022-02-25 03:34:36 UTC Comment hidden (obsolete)
Comment 4 m_a_riosv 2022-02-25 16:47:20 UTC
Not sure if it is a bug.
You are a reference to the same object, so I think no way to set up a difference reference for every object.

There is a help on how to do it. https://help.libreoffice.org/latest/en-US/text/swriter/guide/table_insert.html?DbPAR=WRITER#bm_id3156377

There are two ways of having the link, directly and updated from Menu/Edit/Link to external files, or indirect, where you need to enter first in the object to update.

With the first, pasting as DDE, you need to create the format for the data as DDE only link the data.

Second way:
- Copy the range in calc.
- Paste-special in writer as LibreOffice calc, or create a new spreadsheet object without link.
- Enter to the object and Paste-special as Link.
- Remember, you need to enter the object to update Menu/Edit/Link to external files.
- Unfortunately, there is no a direct way to update the content of this objects at once.
Comment 5 tomasz.sztejka@polon-alfa.pl 2022-02-28 08:17:45 UTC
Correction to my report. 

The statement:
>(...) 
> b) could not replicate in on Windows with inserted Writer documents as OLE objects. (...)

is no longer correct. 

I can replicate it. My confusion was due to the fact that "save" operation doesn't do anything until there is a change in a document text even tough the view of document did change and is apparently saved in document. Currently I can observe, that even with a SINGLE linked view what is seen through linked view after an update reflects what was visible in inserted document during recent save.

I may agree that having two views of the same object may be something developers did not thought about. The fact however that information stored inside an odt file about a single view looks like:

<draw:object xlink:href="../B.odt" xlink:type="simple" xlink:show="embed" xlink:actuate="onLoad"/>

shows that there is absolutely no information about what region of document is to be displayed. This is, I think, conceptually wrong. Sadly I can't see in ODF specs anything what could suggest a kind of "view port" transformation which ought to be applied to object, but I am not an expert in it.

I can agree that for <draw:object-ole>, where drawing is fully controlled by an unknown application this may be a problem, but for well known open document objects it should be doable.

As it is now there is absolutely no point in using this functionality because it will only produce a confusion. 

So possibly it is not a programming bug but a conceptual overlook. 

@m.a.riosv

DDE is no-go, because such a document won't be portable open document anymore (docs do say: "windows only").

I agree that I can get to expected goal in many different ways, but I tried to do it using that functionality since it looked ideal for the purpose. With it working as I expected I could have the computing power of Calc with visual elegance of Writer documents.
Comment 6 Daz 2023-01-17 23:36:41 UTC
Hi, I can confirm the behaviour, and what looks like a misconception.

I present here my use case :
I have a big report I have to produce regularly. It has the same structure, but the data and some commentary can change. So the most practical seemed to me to create a ODT file where I fix the structure, and a ODS file where I do the data processing and generate some charts. Then I want the data and charts to be included in the ODT, and automatically updated once I change the ODS file.

But as said, this is not possible currently because there is only one "view" possible for each ODS file embedded. I think this feature has an enormous potential for professionnals (I did not even find it possible to do this with MS Office), but is not yet properly designed.

I almost succeeded in having the right behaviour, by adding first a non-linked spreadsheet OLE  to the ODT, then editing it by adding a linked sheet (in OLE Edit Mode, menu Sheet > Insert sheet from a file) which seems to conserve the displayed data. The issue is that as the OLE is non linked, it won't be updated with the usual "Tools > Update > Update All" or at the opening of the ODT. To update it, I must go in the OLE Edit Mode, then "Edit > Links to external files", then update manually all the links. The "Automatic" button can't be checked. This is not useful when you have a big report with a lot of linked OLE (too many clicks, not productive). But this would be the researched behaviour, lacking the automatic update function.

Please note that I am ready to pay for this function, I don't know if a bounty can be opened for that, nor if there is a bounty platform or process for LibreOffice ?
Comment 7 Daz 2023-01-17 23:43:00 UTC
Another user with a similar experience : https://ask.libreoffice.org/t/ods-added-in-writer-as-ole-object-displays-wrong/33332
Comment 8 Mike Kaganski 2023-09-11 07:23:36 UTC
(In reply to tomasz.sztejka@polon-alfa.pl from comment #5)
> DDE is no-go, because such a document won't be portable open document
> anymore (docs do say: "windows only").

This is a bug in documentation [1]. While DDE is indeed somewhat Windows-inspired (just the same way as OLE), it works on any platform whet considering linking Calc tables into Writer. Needs own bug report.

[1] https://help.libreoffice.org/latest/en-US/text/swriter/guide/table_insert.html?DbPAR=WRITER