Answer the question
In order to leave comments, you need to log in
How to create a service to automatically change a word document?
I want to create a service in which the word document was changed by a macro when it was loaded (for example, the font became 16 and justified), and then it was given to the user for download already corrected. How to implement? asp.net?
Answer the question
In order to leave comments, you need to log in
ASP.NET does not have tools for editing office documents built into the core. You can use any platform for which there is at least some plugin or library for editing .doc/.docx . I mean - any major platform.
Well, for example, you can do all the file processing in PowerShell (requires installed word\office) on the server where the service will run.
Change document: In the example, the entire font in the document (regardless of what was) is changed to the specified
PS C:\WINDOWS\system32> $WordApp = New-Object -ComObject word.application
PS C:\WINDOWS\system32> $WordApp.Visible = $false
PS C:\WINDOWS\system32> $doc=$WordApp.Documents.Open('C:\Rules\1.docx')
PS C:\WINDOWS\system32> $doc.Content.Font.Name = 'Castellar'
PS C:\WINDOWS\system32> $doc.Close()
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question