NetOfficeFw / NetOffice

🌌 Create add-ins and automation code for Microsoft Office applications.
MIT License
695 stars 143 forks source link

Clone Method not work well #413

Closed heavymanto closed 3 months ago

heavymanto commented 3 months ago

Using NetOfficeFw.Core.1.9.5\lib\net462\NetOffice.dll

 NetOffice.WordApi.Application appWord = new NetOffice.WordApi.Application();
            NetOffice.WordApi.Document docTemplateOrig = ConvetDocumentUtility.OpentWord(docPath, appWord);
            try
            {
                foreach (System.Data.DataRow itemRow in dtTemplate.Rows)
                {
                    NetOffice.WordApi.Document docTemplate = (NetOffice.WordApi.Document)docTemplateOrig.Clone();

I would like to use the same template and save many time for speed up OpentWord each time. But seem not cloning well because, the second cycle I have the data of first cycle, and if a close first cycle document, in second cycle raise Exception, documet close.

Thanks you

jozefizso commented 3 months ago

I am sorry, I don't provide support for the behavior of Office COM model.

You can try StackOverflow, Microsoft Support or to troubleshoot the problem yourself based on Microsoft documentation.