Skip to content

Conversation

@dnenov
Copy link
Collaborator

@dnenov dnenov commented Jul 8, 2025

Purpose

This PR follows the issue discussed here: https://jira.autodesk.com/browse/DYN-9028 - Formulas breaking (not recomputing) after exporting new data using OpenXML node to an existing Excel with Formula

Note:
Formulas will be correctly evaluated when the user opens the file in Excel. However, OpenXML, and as a consequence Dynamo, does not have capacity to evaluate formulas. . Dynamo cannot directly consume the results of the formula-driven fields, unless they have been pre-cached by Excel.

Declarations

Check these if you believe they are true

  • Is documented according to the standards
  • The level of testing this PR includes is appropriate
  • User facing strings, if any, are extracted into *.resx files
  • Snapshot of UI changes, if any.
  • Changes to the API follow Semantic Versioning and are documented in the API Changes document.
  • This PR modifies some build requirements and the readme is updated
  • This PR contains no files larger than 50 MB
  • This PR introduces new feature code involve network connecting and is tested with no-network mode.

Release Notes

  • requests full calculation when opening the excel file after writing it with Dynamo OpenXML
  • small bug fix when stylesheet.NumberingFormats is null
  • no testing, as OpenXML won't let us evaluate the formula results

Reviewers

@jasonstratton
@zeusongit
@achintyabhat

FYIs

@reddyashish

dnenov added 2 commits July 7, 2025 16:01
- requests full calculation when opening the excel file after writing it with Dynamo OpenXML
stylesheet.NumberingFormats can be null, this prevents from null exception to happen
@github-actions github-actions bot changed the title force recalculate formula fields DYN-9028: force recalculate formula fields Jul 8, 2025
Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

See the ticket for this pull request: https://jira.autodesk.com/browse/DYN-9028

@dnenov dnenov marked this pull request as ready for review July 8, 2025 14:58
@zeusongit zeusongit requested review from a team and Copilot July 8, 2025 16:14
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR ensures that Excel formula fields are recalculated when the file is opened and adds a null‐safe check for numbering formats when formatting cell values.

  • Forces full recalculation of formulas on load
  • Adds null check around stylesheet.NumberingFormats to avoid NRE
  • Returns unformatted value string if no numbering format is found

Reviewed Changes

Copilot reviewed 1 out of 1 changed files in this pull request and generated 2 comments.

File Description
OpenXmlHelper.cs (Write method) Appends CalculationProperties and sets FullCalculationOnLoad = true to force formula recalculation
OpenXmlHelper.cs (GetCellValue block) Uses null‐safe access (?.ElementAt) on NumberingFormats and early returns unformatted string when missing

Copy link
Contributor

@jasonstratton jasonstratton left a comment

Choose a reason for hiding this comment

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

LGTM! Thank you.

Copy link
Contributor

@zeusongit zeusongit left a comment

Choose a reason for hiding this comment

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

@zeusongit zeusongit merged commit 6d43d82 into DynamoDS:master Jul 9, 2025
29 of 33 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants