Spire.Doc is a professional Word .NET library specifically designed for developers to create, read, write, convert and print Word document files. Get free and professional technical support for Spire.Doc for .NET, Java, Android, C++, Python.

Mon Apr 25, 2016 2:08 pm

Hey folks,

I need to parse a Word (DocX) document and tried Spire.Doc. The document contains links to Excel-Cells, which are Fields like:
LINK Excel.Sheet.12 Excel-Test.xlsx Tabelle1!Z1S1 \a \t \u \* MERGEFORMAT


The problem is, when the field links to more than one cell, like:
{ ... Tabelle1!Z1S1:Z2S1 ...}
I get an exception (The given path's format is not supported.) when I try to open the DocX-File

Any idea, how I can solve this?

Thanks in advance,
Frank

FrankS
 
Posts: 2
Joined: Mon Apr 25, 2016 1:02 pm

Tue Apr 26, 2016 2:05 am

Hi,

Thanks for your posting.
To help us replicate your issue and work out solution for you, please share your Docx document. If it is not convenient to attach documents here, you can send it to support@e-iceblue.com. Thank you.

Best Regards,
Amy
E-iceblue support team
User avatar

amy.zhao
 
Posts: 2766
Joined: Wed Jun 27, 2012 8:50 am

Tue Apr 26, 2016 10:03 am

Dear Amy,

thanks for your help! I played around a bit more and it looks like it's a microsoft-problem. It's quite easy to reproduce (at least for me with Office 2013. Finally, Microsoft managed to exclude (or hide) the usual info about the version of the software, so I can't tell the specific version, but I should be up to date with it.)

So, put a simple Excel-File and a Word file in the same folder. Open the excel-file and mark 2 cells, copy them. Open your word file and paste the link (Paste -> Pate special ... -> Choose "Paste Link" and as "Microsoft Excel Workbook Object", hit OK [Wording might be incorrect, I translated it from the German version]). If you press Alt+F9 in Word, you will be displayed the "code" behind the link instead of the value. It should show something like

LINK Excel.Sheet.12 "C:\\tmp\\Test\\Excel-Test.xlsx" "Tabelle1!Z1S1:Z2S1" \a \p


Now, save the file. Make sure, you are still in "display-code-mode". Close it. Open it. You'll get a message that Word want's to refresh the links. In the Word file, one can already see the loaded content. And see that it changed to:

LINK Excel.Sheet.12 "C:\\tmp\\Test\\Excel-Test.xlsx!Tabelle1!Z1S1:Z2S1" "" \a \p


Obviously, when Word saves the document, it breaks the LINK-code. Hit whatever you want about the refresh message. After that, the parser of Word is able to restore the broken code again, so you won't realise what happend, when you don't see the code of the LINK.

And this is probably also the reason, why your parser can't load the docx. I also tried open OpenXML-SDK, it can open the File, but it's still unable to correctly interpret the broken LINK, so I am unable to work with it.

I attached my Office-files, removing the Path, so Word can actually find the corresponding Excel-file in the same folder.

FrankS
 
Posts: 2
Joined: Mon Apr 25, 2016 1:02 pm

Wed Apr 27, 2016 7:34 am

Hi,

Thanks for your further information.
I did a test that creating a Word document by Word2013 and then loading it using our Spire.Doc. It can be loaded successfully and also can generate an new file, attached my testes files. Please test if my files can work on your side.
Code: Select all
  Document doc = new Document();
            doc.LoadFromFile("..\\..\\Input\\7462\\1.docx");
            doc.SaveToFile("..\\..\\Input\\7462\\2.docx",FileFormat.Docx2013);


Best Regards,
Amy
E-iceblue support team
User avatar

amy.zhao
 
Posts: 2766
Joined: Wed Jun 27, 2012 8:50 am

Thu Apr 28, 2016 8:01 am

Hi,

Did you test my file? How did it work on your side?
Thanks for your feedback in advance.

Best Regards,
Amy
E-iceblue support team
User avatar

amy.zhao
 
Posts: 2766
Joined: Wed Jun 27, 2012 8:50 am

Return to Spire.Doc