ronkok / Hurmet

Rich text editor on the web, featuring live calculations.
https://hurmet.org/
23 stars 0 forks source link

Feature Request exporting vectors/data frame to text file #29

Closed swopnil123 closed 2 days ago

swopnil123 commented 4 days ago

Do you have plans to add this feature where we could export data frame/vectors/matrices to text file?

ronkok commented 4 days ago

You can already copy a Hurmet result onto the clipboard, but it is a bit awkward. The awkward part is that you must first select a Hurmet calculation cell without opening the source code. To do that, place the selection point just after the cell, hold down the shift key, and hit the left arrow button.

After you have selected (but not opened) a cell, you can hit Ctrl+C for copy. Hurmet will save the result of the cell onto the clipboard.

I need to clean up how that clipboard text writes a vector or matrix. I'll do that later today.

I am also considering an optional format for saved documents. The optional format would save calculation results, not just the user entries for each calculation cell.

swopnil123 commented 3 days ago

Yes, we can copy to clipboard that way. Pasting to text file is easy. The format remains intact. However Excel messes it up. Lot of post processing is required.

This is text file image

This is excel image

ronkok commented 3 days ago

In your data frame example, the only post-processing necessary is the deletion of the opening and closing backtick delimiters. Then it will paste in nicely.

For the general case, I will point out that a browser-based program cannot do a universally compatible copy. Desktop programs are different. They typically copy in several formats (proprietary, HTML, RTF, plain text, etc.) and put all the formats onto the clipboard. Then when an app does a paste, it can choose its compatible format.

Running in the browser, Hurmet cannot copy in multiple formats. The browser's native copy format is HTML. Using JavaScript, I can pre-empt that format and substitute a plain text version instead. Since I only get one format, I choose to write plain text that can be pasted directly into a Hurmet document.

Pasting into other apps will sometimes require some post-processing. I know of no way around that.

I have added a new option to the Hurmet Markdown menu. You can now copy a version that includes calculation results.

swopnil123 commented 2 days ago

Thanks! That solves a lot of problem.