Comments (10)
Hi dematron, thanks for your issue. I have to add conditional formatting support for worksheet to fix this issue.
from excelize.
Cool. Thanks. Work really better. But still one moment.
If I have multiple rules for one cell, I suppose it's because of that, they don't apply as expect.
For example
I have an auto rule - 90% red color, 90%-70% yellow color, less then 70% green color.
After using UpdateLinkedValue(), linked cells updates but value in source cell is for example 20%, but color in linked cell is red (for some reasons, I don't know why).
If I after that in Excel change value in source cell from 20% to for example 80%, I see yellow color in linked cell (as expected).
from excelize.
I have tested that and it works well. Please provide file attachments If you can.
from excelize.
In attachment two files:
First - is a template, which is used for adding data
Second - is the result file after adding data to cells and using UpdateLinkedValue
Sheet 7 is the result aggregated file with linked cells and auto formatting rules.
result.xlsx
template.xlsx
from excelize.
I found that all cell linked value is string type, they don't apply as expect conditional formatting. Such as: H8 on Sheet 7 in the result.xlsx, linked value is H8 on Sheet 3, but '3'!H8
is string type, use SetCellValue("Sheet3", "H8", 0.12)
to make it works well.
from excelize.
I tried your variant but with no success :(
I attache an example, similar to what I use.
First I found that I become to loose formatting (suppose because of that fix #54 )
Second I still can't reach need result - percent on source sheet3 and linked sheet7. And colors of course.
Suppose, I use your code not correctly. But where?
You can repeat what I do by rename template.xlsx to result.xlsx, and apply the code.
Just add that previously I used
xlsx.SetCellStr(sheet, cell, strconv.Itoa(int(value))+"%")
in WriteToXlsxPrc func.
temp.go.txt
from excelize.
What format is missing after fix issue #54? I have try to run temp.go
to write result.xlsx
(renamed by template.xlsx
). I suggest that replace value, _ := strconv.ParseInt(strconv.FormatFloat(data, 'f', 0, 64), 10, 64)
with value := data / 100
, and format cell for the percentage that needs to retain two decimal precision (0.00%
build index is 10
) such as '3'!H5:H11
by function SetCellStyle()
.
from excelize.
For some reasons, after running temp.go file, result is like an attached file.
Formatting on Sheet3 in column G is lost (I mean borders).
If I checkout to - 7c3f91a, and run code again - borders are on their places.
result.xlsx
from excelize.
I have changed to using cell style priority when the cell and the column at the same time with the style attribute.
from excelize.
Perfectly well! I suppose this issue can be marked as closed.
Also I should say that percent cell also work as expected.
For me
"number_format": 9,
in SetCellStyle, and
SetCellValue(sheet, cell, value/100.00)
were the solution.
May be it is the normal behaivour of Excel, to make percents in cell as Value * 100%, but for me it was really surprised.
May be it will be helpful for others if you add some demo code, how to work with percent cells.
Again thanks for your work.
from excelize.
Related Issues (20)
- Why can not read empty value? HOT 5
- AddPicture Method: Identifying Scale Adjustment Direction and Proposing Enhanced Functionality HOT 4
- No excelize.NewFile() in Breaking change. HOT 1
- RawCellValue doesn't work when passed in OpenReader function HOT 2
- Shared SWITCH Formula not working on the generated file HOT 2
- iteration performance on rows with zero Columns HOT 1
- Found a defect in the FIND function during the process of multi-value query. HOT 5
- Different gradient fill colors return the same style index HOT 2
- DataValidation is unsafe when used in concurrent condition
- supports batch append data validation to the worksheet HOT 1
- RemoveCol return error: errors.errorString{s:"the column number must be greater than or equal to 1 and less than or equal to 16384"} HOT 1
- AutoFilter stops working on 2.8.1 (worked on 2.8.0) HOT 2
- dataValidations range issue HOT 1
- Is Streamwriter can set ConditionalFormatOptions? HOT 2
- File.CalcCellValue fails for "=DATE(2020,10,21)+1" formula HOT 2
- GetDataValidations in a sheet does not list all the validations HOT 3
- Flamegraph of `CalcCellValue` shows lots of time spent doing `runtime.duffcopy` inside `getSharedFormula` HOT 1
- Addition of SortState for Table HOT 1
- Is webp (image format) supported? HOT 3
- 使用官方案例生成的Excel无法打开 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 excelize.