Word library slower outside of build folders

Felipe Gonzalez 1 Reputation point
2021-04-06T17:05:15.84+00:00

Hi everybody,

I am currently facing an issue with my C# Application that edits and saves multiple word files.

The issue is that it runs in around 2 minutes when running through Visual Studio, including running it directly from the build folders. But once I move the binary files into another directory, I have noticed by attaching to the process, that it really slows down when Saving the word document, making the whole process last 2 hours.

Is there something that I need to setup or check, in order to fix this issue? Let me know if you require additional information.

Current Word version is:

Microsoft 365 MSO (16.0.13127.21210)

Current Interop.Word version is:

14.0.0.0

Thanks,

  • Felipe
C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
10,375 questions
Word Management
Word Management
Word: A family of Microsoft word processing software products for creating web, email, and print documents.Management: The act or process of organizing, handling, directing or controlling something.
900 questions
{count} votes

2 answers

Sort by: Most helpful
  1. Karen Payne MVP 35,201 Reputation points
    2021-04-06T17:39:52.327+00:00

    There may be permission issue or an issue with anti-virus software assuming all you did was copy the binaries and used the same build configuration. An alternative is to consider using Open XML for Office documents which is considerable more code but does not rely on office automation.

    Also, if the binaries are used on a server this usually slows processing somewhat or to a snails pace.

    To get a taste of Open XML for Office documents see Microsoft TechNet Wiki article Office Word Basic operations: Open XML SDK 2.5 Office Word documents and full source.

    0 comments No comments

  2. David 146 Reputation points
    2022-02-15T02:46:18.923+00:00

    Hi, if you do not mind using a 3rd party library, I would suggest that you could try Spire.Doc for .NET, which is a C# class library for processing word documents in a .NET application and it does not require MS Word to be installed on your computers. It reads and writes word files faster than Interop.Word or Open XML.

    Also, it offers a community version (only without file format conversion feature) for developers to manipulate word documents easily.

    0 comments No comments