microsoft / advanced-formula-environment

Create, edit, and reuse formulas in Excel
https://aka.ms/get-afe
MIT License
113 stars 11 forks source link

Line breaks are not passed from grid formatting into the formula bar #35

Closed SergeiStPete closed 1 year ago

SergeiStPete commented 1 year ago

Screenshot 2022-12-02 223257 Doesn't matter it was sinle- or multiline formula in formula bar, it always is returned as single-line formula. Not sure when it appeared, not a long ago. Did I miss something?

jack-williams commented 1 year ago

The button was there since the 1.1 release. We did make a change to the behaviour when saving though (because of a bug)

We now have a setting for auto format:

They buggy behaviour in 1.1 was to only format to fit in AFE, and to also save that formatted formula to Excel. This often made it hard to read the formula in Excel because we split it into multiple lines.

I’m open to having the existing behaviour as an option. Though, it can be recreated by disabling auto-format but using ctrl-shift-F to manually format prior to saving.

SergeiStPete commented 1 year ago

I see, thank you for the clarification. Like your suggestion to disable auto-format as available to user option. As for me I'd prefer to separate formatting and sync between formular bar and AFE pane functions. Now Save button first reformat formula to fit the pane and save it reformatted in formula bar. Returning formula back from formula bar we see it automatically reformatted in AFE pane. AFE formatting I'd prefer formula is returned as it is in formula bar and add Ctrl+Shift+F as another button in UI. Save only saves as it is. Something like in Tabular Editor Tabular ediotor. My guess many people will prefer to stay on auto-formatting, but perhaps I'm not alone who'd like to have more control on formatting.

jack-williams commented 1 year ago

I'd prefer formula is returned as it is in formula bar and add Ctrl+Shift+F as another button in UI. Save only saves as it is. Something like in Tabular Editor

You can almost do this now in AFE. With this setting off:

image

The formula is returned as it is in the formula bar, and saved out as it is in AFE. (So if you read and save in AFE with no change, the formula is unchanged).

We do not have a button in the UI, but there is a context menu in the editor: image

jack-williams commented 1 year ago

I'm going to close this issue as most of the requirements are implemented in AFE. The missing component is a button to trigger formula format. Feel free to create a new issue specifically for this interface change.