Git Product home page Git Product logo

Comments (10)

xuri avatar xuri commented on May 8, 2024

Hi dematron, thanks for your issue. I have to add conditional formatting support for worksheet to fix this issue.

from excelize.

dematron avatar dematron commented on May 8, 2024

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.

xuri avatar xuri commented on May 8, 2024

I have tested that and it works well. Please provide file attachments If you can.

from excelize.

dematron avatar dematron commented on May 8, 2024

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.

xuri avatar xuri commented on May 8, 2024

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.

dematron avatar dematron commented on May 8, 2024

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.

xuri avatar xuri commented on May 8, 2024

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.

dematron avatar dematron commented on May 8, 2024

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.

xuri avatar xuri commented on May 8, 2024

I have changed to using cell style priority when the cell and the column at the same time with the style attribute.

from excelize.

dematron avatar dematron commented on May 8, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.