Hi,
Thanks for the files, I was thinking the issue was about embedded objects, now I can see it more clearly.
Sadly it is a little more complex than just copying the parts: Those parts missing are a recalculating cache (so, as you mention, the file can be calculated without the linked files), and FlexCel assumes by default their data is likely invalid (because it almost always is), so it doesn't use them. FlexCel requires the real files in order to ensure everything is coherent. If you add the linked files to a TWorkbook and recalculate the full thing, FlexCel should calculate the full file and write the correct data, so you would see the file fine when you open it, even if the linked files aren't there. (see FlexCel API Developer Guide | FlexCel Studio for VCL and FireMonkey documentation )
Note that if you use a TWorkbook to calculate the real file the file will be ok, you will be able to see it, but it still won't have the full linked recalculation cache, as it isn't really needed and normally ends up with outdated data.
The design decision of not using the cache just is because as said, in our experience this data is almost always outdated, and if you are creating a new file to send to your customers (most common FlexCel use case), this just leads to files with wrong data and very difficult to find bugs. Also there are real security concerns in embedding the data from other files, that's why we require you to manually specify the real files you want to link. (I had a question a month ago about this by a customer who is doing a security audit of his app, and luckily we do the right thing on that)
What we could do here is:
- For saving: We could write the full cache with sheet names + data (file externallink.xml) if you use a TWorkbook instead of writing just the sheet names as we do now. I don't see a problem with that, we just don't do it because it isn't needed: Excel will still show the right values without that cache if you calculated it right when you saved it.
- For opening: We could have a mode where we read the cache if the files are missing, but that would be off by default. Excel and FlexCel have different use cases: Excel is an interactive app where is easy to show a dialog telling you "the cache is outdated", but FlexCel is non-interactive and we just need to create the file you told us without warning you. And the idea is that if you are dealing with linked files, you have all the linked files, why would you use them if not?
But I can see some use cases for it, so I'll add this request of reading the data from the cache to our todo list.
About AlternateContent in xl\Workbook, what I see missing is:
<mc:AlternateContent xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006">
<mc:Choice Requires="x15">
<x15ac:absPath url="\\Test\d$\Test\Reports\Templates\" xmlns:x15ac="http://schemas.microsoft.com/office/spreadsheetml/2010/11/ac"/>
</mc:Choice>
</mc:AlternateContent>
As you can see, this ' Requires="x15" ' which means it is only for Excel 2013 and newer. Linked files work since Excel 5 at least, so this isn't really needed for linked files to work, and I personally never understood why would we want to save the full absolute path of the linked files. This is again just redundant data that can get out-of-sync with the real data of where the files are (the filenames of the linked files are in externalLink1.xml.rels ). So we made a conscious decision not to save that data. It adds nothing (the filenames Excel uses are not there), it can end up having a different value if you manually edit the file, and having full, not relative filenames is a small security risk: It could be giving away names of servers in your organization that you didn't mean to be public.