Spire.Doc is a professional Word .NET library specifically designed for developers to create, read, write, convert and print Word document files from any .NET platform (C#, VB.NET, ASP.NET, .NET Core) and Java applications (J2SE and J2EE) with fast and high quality performance.

Fri Jan 04, 2013 4:58 pm

The code looks like this: spireDoc.SaveToFile(outputFile + ".docx", FileFormat.Docx2010);

The error exception looks like this:
System.Collections.Generic.KeyNotFoundException: The given key was not present in the dictionary. at System.Collections.Generic.Dictionary`2.get_Item(TKey key) at ck.b(nm A_0) at ck.c(nm A_0) at ck.i(ParagraphBase A_0) at ck.c(Paragraph A_0) at ck.a(Paragraph A_0, Boolean A_1) at ck.e(TableCell A_0) at ck.a(CellCollection A_0) at ck.a(TableRow A_0, Boolean A_1, Boolean A_2) at ck.a(RowCollection A_0) at ck.f(Table A_0) at ck.a(BodyRegionCollection A_0, Boolean A_1) at ck.h(Section A_0) at ck.ai() at ck.ap() at ck.a(Stream A_0, Document A_1) at Spire.Doc.Document.SaveToFile(Stream stream, FileFormat fileFormat)

I have attached a zip file with the offending document template. <PlaceHolders> in this document are replaced using SpireDoc.Replace function before calling SaveToFile

We are using Spire.Doc version 4.4.30

A prompt resolution would be greatly appreciated

p.s. when I tried to upgrade to the latest version (4.5), I got the 3 compilation errors below:

'Spire.Doc.FileFormat' does not contain a definition for 'PDF'

'Spire.Doc.Document' does not contain a definition for 'SaveToImages' and no extension method 'SaveToImages' accepting a first argument of type 'Spire.Doc.Document' could be found (are you missing a using directive or an assembly reference?)

'Spire.Doc.FileFormat' does not contain a definition for 'Html'
You do not have the required permissions to view the files attached to this post.

itsupport
 
Posts: 10
Joined: Thu Jun 14, 2012 7:18 pm

Sat Jan 05, 2013 6:59 am

Hello itsupport,

Thanks for your inquiry.
Spire.Doc_Standard_Version:4.5 don't support doc to pdf/image convertion. Please download Spire.Doc Pack Version:4.6 (downlaod link is http://www.e-iceblue.com/Download/download-word-for-net-now/spiredoc-pack-v-4-6.html?Itemid=0) which can support doc convertion.
About the first problem, we suggest you use the dlls of spire.doc_4.6 to retest it. We did a simple test with spire.doc_4.6 and didn't reproduce your problem. We attached test code below and output docx file. If you still have the problem, please provide us your replace code. So that we can reproduce your problem soon and work out a solution for you. Thank you!
Code: Select all
            Document document = new Document();
            document.LoadFromFile(@"..\..\EnrollmentForm.docx");
            string pattern = @"<\w+>";
            Regex match = new Regex(pattern);
            document.Replace(match, "HelloWorld");
            document.SaveToFile(@"sample.docx",FileFormat.Docx2010);


Best regards,
Amy
E-iceblue support team
You do not have the required permissions to view the files attached to this post.
User avatar

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

Mon Jan 07, 2013 7:38 am

Hello itsupport,

Do you still have the problem? If you do, could you please provide us your code about replacing <PlaceHolders>? So that we can quickly reproduce your problem and solve it. Thank you!
Have a great day!

Best regards,
Amy
E-iceblue support team
User avatar

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

Thu Jan 10, 2013 10:28 am

Hello itsupport,

Did your problem have been solved? If you still have the problem, please tell us.
Have a great day!

Best regards,
Amy
E-iceblue support team
User avatar

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

Return to Spire.Doc

cron