我想要做的不是在 Google Sheets 中,而是在常规的 Google Docs 文字处理程序中。我使用的文本文档有一堆表格,每个表格下面都有一段、两段、三段文本,而不是作为表格本身的一部分。该表包含包含各种信息的列,但其中一列是“单词”,目前我必须手动突出显示下面的该部分,转到“工具”找到“字数统计”,然后查看它是什么。然后,如果我编辑下面的部分,我会重复该过程。
其中一些文档有数十个甚至数百个这样的单独部分(表格,下面有文本直到下一个表格),因此有某种方法来自动更新该字段将是令人难以置信的。
有没有办法让表格的单元格查看下面的文本并计算字数?
每个表格上方都有一个 H3 标题,所以我的想法是以某种方式识别和计算表格末尾和下一个 H3 之间的单词。
结构是:
H3 level title
Table
Text
Text
Text
H3 level title
Table
Text
Text
等。
这是显示我希望做什么的文档的链接:link
有一些额外的小事情需要考虑,但只要知道这是否可能就很好了。
我正在运行 Lubuntu 20.04LTS,使用 Chrome 作为浏览器,如果这有什么区别的话。
What I'm looking to do is NOT in Google Sheets, but regular Google Docs wordprocessor. I'm using a text doc that has a bunch of tables and each table has a paragraph, two, three of text below it, not as part of the table itself. The table has columns with various info, but one of them is "words" and currently I have to manually highlight that section below, go up to the "Tools" find "Word Count" and then see what it is. Then if I edit the section below, I repeat that process.
Some of these documents have dozens or even hundreds of these individual sections (table, with text below until the next table) so having some way to automatically update that field would be incredible.
Is there any way to have a cell of the table look at the text below and calculate the wordcount?
Each table has a H3 title above it, so my thought would be to somehow identify and count words that are between the end of the table and the next H3.
The structure is:
H3 level title
Table
Text
Text
Text
H3 level title
Table
Text
Text
etc.
Here's a link to a document showing what I'm hoping to do: link
There are a few small additional things to consider but just knowing if that's possible would be great.
I am running Lubuntu 20.04LTS, using Chrome as the browser, if that makes a difference.
描述
我已经针对您的具体情况开发了一个脚本。字数统计可能不准确,因为此脚本仅使用空格作为单词之间的分隔符。如果有制表符或其他字符,计数可能会关闭。字数统计的主题之前曾在 stackoverflow 上出现过,但没有一个万无一失的计数器。
基本上它会跳过标题,跟踪下表以填充字数,然后计算表格和下一个标题之间的单词数。
我已经编辑了脚本,如果单词以黄色突出显示,则从计数中省略。但是,我观察到,如果一个单词以标点符号结尾并且没有突出显示,那么它就被视为一个单词。所以你再次可以看到在字数统计中有很多事情需要考虑。
修复了段落以突出显示开头的情况。
脚本
参考
Description
I've developed a script for your specific situation. The word count may not be accurate as this script only uses a space as a seperator between words. If there is a tab or some other character the count may be off. The subject of word count has come up before on stackoverflow without a fool proof counter.
Basically it skips the header, keeps track of the following table to fill in the word count then counts the words between the table and next header.
I've edited the script to omit from count if words are highlighted in yellow. But, something I observed if a word ends in a punctuation mark and it is not highlighted it counts as a word. So again you can see there are a lot of things to consider in word counting.
Fixed for case if paragraph starts with highlight.
Script
Reference