We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

How to insert the full .doc into another .doc

void InsertWorkItems(IWordDocument wdMaster)
{
WordDocument wd1 = new WordDocument("C:\\docs\\6_C.docx", FormatType.Docx);

wdMaster.Replace("", wd1, false, false, true );



should work right? But I get a object reference not set error even though neither DOC object is null.. ??







9 Replies

BP Bhuvaneswari P Syncfusion Team February 25, 2009 09:24 AM UTC

Hi Matt,

Thank you for your interest in Syncfusion products.

I am afraid that I am unable to reproduce the issue "while replacing the string with document it throwing an exception", its working fine in our end.

Please refers to the below sample:
http://www.syncfusion.com/uploads/redirect.aspx?file=FindandReplace_c68f9916.zip&team=support

Please have a look into the sample and try to reproduce the issue in that sample or send your sample to us to reproduce the issue. This would be very helpful for us to investigate more on this issue and provide a solution.

Note: In subject you have mentioned .doc and in code you have used .docx. But issue is not reproduced in both the formats.

Best Regards,
Bhuvana




MH Matthew Herb February 25, 2009 04:16 PM UTC

ok.. thanks it works now.. Not sure what I was doing wrong before.

Another question while I am here

is there some way to surround parts of text in a document so I can remove certain parts..

In my example the user checks which sections he wants to include and I create the document with those sections..

the workaround I am doing instead is breaking the sections into seperate .doc files and then adding them in a main .doc file..





MH Matthew Herb February 25, 2009 07:24 PM UTC

Found a bug in DOCio it seems.. took me hours..

The problem I was having all was because of a certain type of textbox in Word 2007. Causes

wdMaster.Replace("", wdD, false, false, true);

to error.. I will attach the piece that causes the problem.. without it everything works fine





dd_de2df14e.zip


MH Matthew Herb February 25, 2009 11:22 PM UTC

it is 'smartart' that causes the problem.

DocIO cannot use smartart ?



BP Bhuvaneswari P Syncfusion Team February 26, 2009 11:50 AM UTC

Hi Matt,

Thanks for the instant update.

Currently we do not provide support for preserve or create or manipulating smart tag documents using Essential DocIO.

We have logged feature request regarding this. We will get back to you once the feature is implemented.

Best Regards,
Bhuvana



MH Matthew Herb February 26, 2009 03:50 PM UTC

what solution woudl you recommend?

Only thing I coudl find that works is to save as WORD 2003. But the problem with that is it shrinks the pictures and one instace the text seemed to dissapear .



BP Bhuvaneswari P Syncfusion Team February 28, 2009 10:43 AM UTC

Hi Matt,

Thanks for the update.

I afraid that I am unable to reproduce the issue when we using the doc format. It’s working as expected for doc format. The textbox is not shrinks and the texts are not disappeared.

Here is the sample for your reference:
http://www.syncfusion.com/uploads/redirect.aspx?file=Replace_35d90d6.zip&team=support

Please have a look into that sample and could you please send your modified sample with source document to reproduce the issue in our end. This would be helpful for us to investigate the issue further.

Best Regards,
Bhuvana




MH Matthew Herb March 2, 2009 08:30 PM UTC

I ended up just keeping it docx format and ussing the snipping tool to capture the smartart and repaste it in



BP Bhuvaneswari P Syncfusion Team March 3, 2009 10:39 AM UTC

Hi Matt,

Thanks for the update.

We will get back to you once the smart tag feature is implemented.

Best Regards,
Bhuvana


Loader.
Live Chat Icon For mobile
Up arrow icon