Comments (12)
Thank you and everyone for your generous answers, will continue to support onlyoffice, you can close this now, good luck!
from onlyoffice.github.io.
@AlexeyMatveev686 thank you
from onlyoffice.github.io.
@askonev Please take a look
from onlyoffice.github.io.
et.getRange(color
Hello, let me help you.
You can use this macros for your task:
function CountColoredCells (Range1, Range2)
{
// Range1 is the range where the search will be performed
// Range2 is the range to be compared with when searching
// (if there is more than one cell, it will only be compared with the first one)
var count = 0;
var color = Range2.GetFillColor();
if (color !== "No Fill") {
Range1.ForEach(function(cell) {
var curColor = cell.GetFillColor();
if (curColor !== "No Fill" && curColor.color === color.color)
count++;
});
}
return count;
}
Also you can can check how it works in my example file.
Good luck!
new (1).xlsx
from onlyoffice.github.io.
Sorry, just replied. I still get an error after following your method of testing
.
from onlyoffice.github.io.
@Bobolovewill Hi!
Please specify the version of the product on which you run the script.
from onlyoffice.github.io.
请指定运行脚本的产品版本。
Version: 5.6.5 (build:3)
from onlyoffice.github.io.
@Bobolovewill This is very very old version. Please update to current v6.4.2 and see if problems persists
from onlyoffice.github.io.
@Bobolovewill This is very very old version. Please update to current v6.4.2 and see if problems persists
Sorry for just replying, thanks everyone. The function worked after the upgrade, but I can't call it anywhere, I have to write it in advance. Last question, how to run macros automatically, or is there a shortcut?
from onlyoffice.github.io.
run macros automatically, or is there a shortcut
We got autorun button:
And marcos settings:
Not sure how it works, not my area
Also, you can convert your macros to plugin (it use same code, but require some additional metadata) - you can run plugin with autostart
from onlyoffice.github.io.
@ShockwaveNN Unfortunately, this macro does not work on version 7.5.1, could you please update it?
from onlyoffice.github.io.
@ShockwaveNN Unfortunately, this macro does not work on version 7.5.1, could you please update it?
Hello. If you use example whitch I posted you should add "var" before "oWorksheet" variable into the 3-th line. I've checked this macros, it works fine in 7.5.1 after this changes. Here is new macros:
(function()
{
var oWorksheet = Api.GetActiveSheet();
// the ranges where the search will be performed
var Range1 = oWorksheet.GetRange("A1:B14");
var Range2 = oWorksheet.GetRange("B1:B7");
// the range to be compared with when searching
// (if there is more than one cell, it will only be compared with the first one)
var Range3 = oWorksheet.GetRange("D1");
var Range4 = oWorksheet.GetRange("D1");
var Range5 = oWorksheet.GetRange("D2");
var count = CountColoredCells(Range1, Range3);
var count2 = CountColoredCells(Range2, Range4);
var count3 = CountColoredCells(Range1, Range5);
oWorksheet.GetRange("E1").SetValue("D1 in A1:B14 = " + count);
oWorksheet.GetRange("E2").SetValue("D1 in B1:B7 = " + count2);
oWorksheet.GetRange("E3").SetValue("D2 in A1:B14 = " +count3);
function CountColoredCells (Range1, Range2)
{
// Range1 is the range where the search will be performed
// Range2 is the range to be compared with when searching
// (if there is more than one cell, it will only be compared with the first one)
var count = 0;
var color = Range2.GetFillColor();
if (color !== "No Fill") {
Range1.ForEach(function(cell) {
var curColor = cell.GetFillColor();
if (curColor !== "No Fill" && curColor.color === color.color)
count++;
});
}
return count;
}
})();
from onlyoffice.github.io.
Related Issues (20)
- Zotero plugin show both item and its PDF file HOT 3
- ChatGPT Error in Version 7.4 (Server and Desktop) HOT 5
- Zotero plugin will not insert citations HOT 11
- Allow for citing specific pages HOT 2
- [update idea] youtube plugin (embed in presentation mode) HOT 1
- SetSort always sorts in descending order HOT 1
- Mendeley login doesn't work HOT 1
- Allow using ChatGPT Plugin with LocalAI HOT 1
- Restore Zotero Citations from a Zotero_Transfer_Document HOT 1
- Support more languages for AutoComplete plugin HOT 3
- [Feature] Add support for Bergamot Translator HOT 2
- Allow users to post-hoc edit zotero citation fields HOT 2
- Don't show pdfs in zotero citation preview HOT 1
- Translator Plugin not working HOT 2
- Allow to insert only year of citation with Zotero plugin HOT 1
- Ability to edit a citation HOT 3
- ChatGPT Plugin for OnlyOffice 7.5.0 HOT 3
- Add support for privateGPT HOT 2
- Zotero: support for superscript/subscript in references HOT 10
- ChatGPT for desktop does NOT work HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from onlyoffice.github.io.