Skip to content

Conversation

@JoHoGH
Copy link

@JoHoGH JoHoGH commented Nov 12, 2025

This is a suggestion to remove line breaks from formulas when unpacking MSExcel files so the formula is not broken across multiple lines in Winmerge. Line breaks are often added to improve readability in the MSExcel formula bar, but they are not of any interest when looking for differences.

@sdottaka
Copy link
Member

Thank you for the PR.
In the table comparison window, enabling View → Wrap Text makes WinMerge display actual line breaks within cells.
Since this is often useful, I’d prefer not to always replace line breaks with spaces.
Could this conversion be made optional instead?

@JoHoGH
Copy link
Author

JoHoGH commented Nov 12, 2025

Thanks for looking! Currently, formulas with line breaks do not behave like cell values with line breaks. In the current version any line breaks in the formula creates separate line in the table and changing "Wrap text" does not change that.
For example:
Screenshot 2025-11-12 142609
will look like this in Winmerge table comparison (with Wrap Text off)
Screenshot 2025-11-12 141132

With my proposed change it gives this

Screenshot 2025-11-12 143228

@JoHoGH
Copy link
Author

JoHoGH commented Nov 12, 2025

Hi. I tried a different approach using the quoteIfNeeded function to preserve the line breaks in the formula. Code change and result are below. Personally I prefer my earlier version that changed line breaks to space
Result (Wrap text selected)
Screenshot 2025-11-12 145105
Code change
Screenshot 2025-11-12 144920

@sdottaka
Copy link
Member

Sorry, I misunderstood — I thought you were replacing line breaks with spaces for all cell values, not just formulas.
Quoting formulas with double quotes makes them very hard to read, so I agree that’s not a good approach.

However, I still don’t think replacing line breaks should be the default. It would be better to make it configurable via an option.

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.

2 participants