Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[IMP] xlsx: add support for data bars in CF #4983

Closed
wants to merge 1 commit into from

Conversation

pro-odoo
Copy link
Collaborator

This commit adds the support for import/export of data bars rules.

Task: 4179806

Description:

description of this task, what is implemented and why it is implemented that way.

Task: TASK_ID

review checklist

  • feature is organized in plugin, or UI components
  • support of duplicate sheet (deep copy)
  • in model/core: ranges are Range object, and can be adapted (adaptRanges)
  • in model/UI: ranges are strings (to show the user)
  • undo-able commands (uses this.history.update)
  • multiuser-able commands (has inverse commands and transformations where needed)
  • new/updated/removed commands are documented
  • exportable in excel
  • translations (_t("qmsdf %s", abc))
  • unit tested
  • clean commented code
  • track breaking changes
  • doc is rebuild (npm run doc)
  • status is correct in Odoo

@robodoo
Copy link
Collaborator

robodoo commented Sep 16, 2024

Pull request status dashboard

if (!dataBarElement) return undefined;
return {
color: this.extractColor(dataBarElement.querySelector("color"), theme, "ffffff"),
// TODO ATM, we only support color for dataBar, not the minimum and maximum fill percentage
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

const ruleAttributes = commonCfAttributes(cf);
ruleAttributes.push(["type", "dataBar"]);

// TODO ATM we do not support min and max values, so to have the same result
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

@hokolomopo hokolomopo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tchou tchou

src/xlsx/extraction/cf_extractor.ts Outdated Show resolved Hide resolved

// TODO ATM we do not support min and max values, so to have the same result
// in Excel, we export with min=0 and max=100
return escapeXml/*xml*/ `
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Data bars seem to be exported as gradient fill in excel rather than solid fill

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do not see in the ecma the place I should adapt it.
Export from excel with a solid and a gradient:

<cfRule type="dataBar" priority="3">
  <dataBar>
    <cfvo type="min"/>
    <cfvo type="max"/>
    <color rgb="FF638EC6"/>
  </dataBar>
</cfRule>
<cfRule type="dataBar" priority="1">
  <dataBar>
    <cfvo type="min"/>
    <cfvo type="max"/>
    <color rgb="FF638EC6"/>
  </dataBar>
</cfRule>

Don't see any difference 😅

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So it looks like Excel do not use the OpenXML databars, but its own custom databar type.
TBD if we want to stay standard, or if we want to match excel
https://learn.microsoft.com/en-us/openspecs/office_standards/ms-xlsx/88c5ca0a-3a34-4fad-8c91-fdb4550d3fe1
image

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what version of excel where you using btw ? This is the result I get using Excel 365 desktop

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I used excel online.

TBD if we want to stay standard, or if we want to match excel

Don't know, IMO we should stay standard but I don't have a strong opinion on this

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds annoying without much gains TBH. I vote to ignore this.

(I also have the x14:dataBar in excel online tho 😅 )

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So it's re-ready :D

tests/xlsx/xlsx_export.test.ts Outdated Show resolved Hide resolved
This commit adds the support for import/export of data bars rules.

Task: 4179806
@pro-odoo pro-odoo force-pushed the master-excel-support-databar-pro branch from e6edd83 to ccca2d8 Compare September 25, 2024 12:04
@rrahir
Copy link
Collaborator

rrahir commented Nov 8, 2024

@robodoo r+

robodoo pushed a commit that referenced this pull request Nov 8, 2024
This commit adds the support for import/export of data bars rules.

closes #4983

Task: 4179806
Signed-off-by: Rémi Rahir (rar) <[email protected]>
@robodoo robodoo closed this Nov 8, 2024
@robodoo robodoo added the 18.1 label Nov 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants