Description: Let's say a user (I don't know which one??) wants to print a draft document that is intended to solicit feedback in ink (not electronic notes or comments), and will modify the document afterwards. This user will print the document in multiple sizes and wants to be able to find his/her position quickly using both sizes, therefore line count is unreliable as a marker of where in the document a piece of text is. I think a word count instead of line count is perfect for this. Maybe this would be a good time to solicit my second idea, which is multiple "style sheets", where draft would be double spaced in a bigger font and final would be single spaced in a smaller font Steps to Reproduce: 1. Enter content 2. Change (paragraph?) formatting option to word count 3. Magic! Actual Results: Only line count is available at this time Expected Results: It would be nice to have Reproducible: Always User Profile Reset: No Additional Info: None.
OK, doing a word count annotation to document canvas seems feasible, modeled on the current "Line Numbering" dialog. Could we also navigate by word count. Maybe establish a movement by blocks of counted words (e.g. 20, 50, 100) and also provide a go-to word. I guess dialog could control counting of words, e.g. not in header/footer and exclude by paragraph. When active, assume we would want it reflected in the status bar. And, maybe also as an additional movement mode for Navigator?
Doubt it's possible. The file format clearly talks about "line number" and we cannot abuse it to show the word count instead - and expect a cross-application compatibility. It would also be required in alien formats such as OOXML/DOCX.
(In reply to Heiko Tietze from comment #2) > Doubt it's possible. The file format clearly talks about "line number" and > we cannot abuse it to show the word count instead - and expect a > cross-application compatibility. It would also be required in alien formats > such as OOXML/DOCX. Cross-application compatibility is not a concern for me, at least here. I'm not sure about your project's guiding principles though. More relevant is how to fit this into the file format, as I know it's standardized. I don't know where to begin on that.
I for got to tell my story... I recently tried to save a document with close to no formatting as a word .docx and LO popped up a dialog warning me that some formatting might be lost if I saved in a foreign format. This is to say that all features need not be available in all formats/applications as long as LO supports it faithfully, unless there is something I don't know. And if there is, I would like to find out.
[Automated Action] NeedInfo-To-Unconfirmed
NEEDINFO for input from Regina
Needinfo for several month now; the line number likely cannot be used for the word count.
Nobody commented on my comment #3. (Or 4 for that matter) There may be opposition to include this in the mainline. I am happy to hack on it myself. I have distro packages installed, but I mainly run a self compiled build. If I could get some pointers on how to begin with this, I would happily maintain it for myself. Another consideration is can this type of functionality be made available through a plugin? tl;dr: 1a) Where is the line count code in Writer? 1b) Where is the word count code in Writer? 2) What are the limitations of the plugin architecture?
If you insert a variable into the document it needs to be defined in the format. And for your use case not only in ODF but also DOCX. In case you just want to show the total count, it means probably to enhance the document statistics (click on the "<n> words, <m> characters" panel at the statusbar). The duplicate ticket here is bug 123083 with some code pointers.
I discussed this in the dev chat and after some back and forth I had an idea that could be implemented as an extension: Insert a comment for each paragraph. The comment contains the word count. When you print, go to the options tab and select Comments: Place in margins. The API command for inserting a comment is .uno:InsertAnnotation Details: https://api.libreoffice.org/docs/idl/ref/servicecom_1_1sun_1_1star_1_1text_1_1textfield_1_1Annotation.html How does that sound? Adding the word count as formatting data would be problematic for compatibility. Showing the count in place of line numbers might be confusing "e.g. when hyphenation is active, or in Asian texts" per one comment. Regarding Stuart's comment 1, it is possible to navigate by words using this API method and looping by different word counts: https://api.libreoffice.org/docs/idl/ref/interfacecom_1_1sun_1_1star_1_1text_1_1XWordCursor.html
(In reply to Heiko Tietze from comment #9) > If you insert a variable into the document it needs to be defined in the > format. And for your use case not only in ODF but also DOCX. Like I mentioned above, I don't care about docx. If I want this feature, I will use odt. (Unless there's something I'm missing...) Thank you for the pointer -- I'll check it out.
(In reply to Buovjaga from comment #10) ... > Insert a comment for each paragraph. > cross > How does that sound? ... My use case demands that a cumulative word count is presented per-line. > Adding the word count as formatting data would be problematic for > compatibility. Based on the comments elicited so far I have given up on cross-format compatibility (as explained in comment #11). > Showing the count in place of line numbers might be confusing > "e.g. when hyphenation is active, or in Asian texts" per one comment. Personally, I do not use hyphenation, but maybe in this case a warning is sufficient? As to your second point, I do not see a future for myself with Asian texts. (But do you mean that they are sometimes RTL?) Right now, I am content to maintain a private fork, with all the pain and suffering this will bring ;) I'm just not familiar with the codebase, so that's what I need help with at the moment. It doesn't seem like this will be mainlined, so, eh...
Another comment from the chat just now: "A simpler solution to the problem is to have a macro that adds word-count fields into the running text, similar it is done to various bible texts (for sentences)."
(In reply to Buovjaga from comment #13) > similar it is done to various bible texts (for sentences). Not to give you work, but could you give a screenshot or something of that nature. Also I have no idea how to do the macros. Please don't ask me to program BASIC. I left that alone in the 90s. (Half sarcasm.)
(In reply to tripleo from comment #14) > (In reply to Buovjaga from comment #13) > > > similar it is done to various bible texts (for sentences). > > Not to give you work, but could you give a screenshot or something of that > nature. > > Also I have no idea how to do the macros. Please don't ask me to program > BASIC. I left that alone in the 90s. (Half sarcasm.) Sorry, I was just relaying the idea of someone else. Maybe some kind soul could help and create such a macro, if you asked in https://ask.libreoffice.org/
(In reply to Buovjaga from comment #15) > Sorry, I was just relaying the idea of someone else. No need to apologize, thank you for your input. ... My use case demands that a cumulative word count is presented per-line. I am not concerned with cross-format compatibility. Just like nobody else (maybe except AbiWord or something (Google Docs??) ) is concerned with ODT compatibility. I do not use any of these other software products. Right now, I am content to maintain a private fork, with all the pain and suffering this will bring ;) WONTFIX is sad, but expected -- I seen this coming. My question is how do I do it myself (without spending the rest of the year punishing myself browsing C++ code?)
(In reply to tripleo from comment #16) > WONTFIX is sad, but expected -- I seen this coming. My question is how do I > do it myself (without spending the rest of the year punishing myself > browsing C++ code?) Like I said in my comment 15, you can request help in https://ask.libreoffice.org/ If it can be done as a macro (Basic or Python), there is no need for C++ code.