Save modified WordprocessingDocument to new file

If you use a MemoryStream you can save the changes to a new file like this: byte[] byteArray = File.ReadAllBytes(“c:\\data\\hello.docx”); using (MemoryStream stream = new MemoryStream()) { stream.Write(byteArray, 0, (int)byteArray.Length); using (WordprocessingDocument wordDoc = WordprocessingDocument.Open(stream, true)) { // Do work here } // Save the file with the new name File.WriteAllBytes(“C:\\data\\newFileName.docx”, stream.ToArray()); }

The ‘Microsoft.ACE.OLEDB.12.0’ provider is not registered on the local machine while data export to MS ACCESS

The reference to the Access Interop bits has nothing to do with your exception and Access Interop is not necessary to use the classes in the System.Data.OleDb. The problem arises when you have your application compiled for AnyCPU Platform, you are running on a 64bit system and the installed ADO.NET provider (Microsoft ACE.OLEDB.12.0) is the … Read more

Error accessing COM components

Problem solved! I have previously installed Office 2010, so there are some inconsistences in Windows Registry. To fix them, open the regedit and find for the CLSID from the error. You will find something like that for the second error: HKEY_CLASSES_ROOT\Interface\{00020970-0000-0000-C000-000000000046} With the subkeys: ProxyStubClsid ProxyStubClsid32 TypeLib Take a look at the (Default) and Version … Read more

tech