Limit number of pages and/or characters in word document

Suggestions on Document Server Installation/Functionality
Post Reply
doriman
Posts: 2
Joined: Fri Apr 16, 2021 11:15 am

Limit number of pages and/or characters in word document

Post by doriman » Fri Apr 16, 2021 11:20 am

Hello there,

I have been tasked with finding out whether it is possible to limit the maximum number of pages and/or characters in a word document.

Additionally, the following two questions were asked by the customer:
1. can all characters above the limit be highlighted in red?
2. can the system (meaning our application) show an error message when going above the limit? (this would require some sort of event to subscribe on in Angular, I guess)

I have checked the documentation, API reference and various pages, as well as StackOverflow, but was not able to find anything.

I am hoping to find some information here.

Thanks!

EugeneB
Posts: 5
Joined: Fri Jan 22, 2021 8:08 am

Re: Limit number of pages and/or characters in word document

Post by EugeneB » Tue Apr 20, 2021 11:32 am

Hi!
Please start with this plugin as an example https://github.com/ONLYOFFICE/plugin-wordscounter and write your part of the js code that colors the text above the limit with red https://api.onlyoffice.com/docbuilder/t ... e/setcolor, the same is with the error message.
To start plugin on a background pl change the plugin's config file accordingly https://api.onlyoffice.com/plugin/confi ... s.isSystem
Here is the plugin structure https://api.onlyoffice.com/plugin/structure
Regarding the limitation - you can't limit the characters however you could erase them on typing programmatically with the plugin

Please debug your script in the macros window first then insert the code into the plugin

doriman
Posts: 2
Joined: Fri Apr 16, 2021 11:15 am

Re: Limit number of pages and/or characters in word document

Post by doriman » Fri Apr 30, 2021 11:11 am

Thank you, EugeneB!

I will have a look at this :-)

Post Reply