Mail Merge, DocIO

Hello,

I'am trying to use mail merge. I've created a simple tamplate which I have stored in wwwroot directory.

When I'am trying to load this template I recive :

 Unhandled exception rendering component: Could not find a part of the path "/wwwroot/data/docio/merge.docx".

System.IO.DirectoryNotFoundException: Could not find a part of the path "/wwwroot/data/docio/merge.docx".


Here is my code sample:

 string basePath = @"wwwroot/";

 string dataPath = basePath + @"data/docio/merge.docx";

 FileStream fileStreamPath = new FileStream(dataPath, FileMode.Open, FileAccess.Read, FileShare.ReadWrite);

 WordDocument document = new WordDocument(fileStreamPath, FormatType.Doc);

  string[] fieldNames = new string[] { "Id", "FirstName", "LastName" };

  string[] fieldValues = new string[] { UserValues.Id.ToString(), UserValues.FirstName.ToString(), UserValues.LastName.ToString() };

....

Could you advaise me somethig?

With best regards 

Jarosław Bolejko



3 Replies

LB Lokesh Baskar Syncfusion Team October 19, 2021 09:42 AM UTC

Hi Jaroslaw,

Thank you for contacting Syncfusion support.

We have tried to reproduce the reported issue in simple ASP .NET Core application but, it works properly at our end. For your reference, we have attached the sample application which we used to reproduce the reported issue and it can be downloaded from the below link:  
https://www.syncfusion.com/downloads/support/forum/169746/ze/DocIOSample2077836526.zip

Could you please try the same sample application at your end and provide us confirmation whether you are facing issue in this simple sample too.

Please let us know if you have another queries.

Regards, 
Lokesh B 



JB Jaroslaw Bolejko October 19, 2021 07:52 PM UTC

Thanks for your quick replay. 

As always you are amazing. Thank you!

I've mange to solve the problem. Sometimes before writing a question people (me:D) should take some sleep and rest. My template in wwwroot was field by data (like Firstname: Jarek), it sould be ready to be field by data (like FirstName: <<FirstName>>).


With best regards 

J





LB Lokesh Baskar Syncfusion Team October 20, 2021 10:02 AM UTC


Please let us know if you have any other queries or problem and we will be happy to assist you as always.
 

Regards,
Lokesh B
 


Loader.
Up arrow icon