Export feature
Closed this issue · 16 comments
Considering this spreadsheet:
Where
- A0, B0, C0 are left justified, centered, right justified labels
- A1, B1 are numeric constants
- C1 is a basic formula (A1 + B1)
C sc
generates an output like this:
# This data file was generated by the Spreadsheet Calculator.
# You almost certainly shouldn't edit it.
leftstring A0 = "asdf"
label B0 = "qwerty"
rightstring C0 = "foobar"
let A1 = 25
let B1 = 33
let C1 = A1+B1
goto C1 A0
Or plaintext:
asdf qwerty foobar
25.00 33.00 58.00
For C sc
, all cells in the export are fixed-width of ten characters - even if the text is longer than 10 characters.
How do you expect this feature to work? Should I simply crop everything after 10 characters or search for the cell with the longest text?
The P command saves as .sc (structured)
The W command saves file as .asc (plain text):
Weight Silver Electricity GAS Days 54.0 6.30 160.00 100.00 3 Material 340.20 Piece 540.00 Labor 199.80 Subtotal 558.50 Guarantee 55.85 Total 614.35
The W command appears to adjust cell lengths in plain text. GOSC allows to view and edit sc files, but have no export scheme as W command.
The sc (both in C and Go) have a command to set the column length. I believe it is not based on the length of the longest word, but rather on the column attributes (f command).
You could try tag v1.1 -- it's working now. Press W to enter a filename, then export somewhere. Attention: it will silently overwrite any existing files
First thank you. It's working, but there's a bug when there's an empty row:
"error exporting: cell at address A2 does not exist in spreadsheet"
Should be fixed now
There is just a little detail missing:
# github.com/scrouthtv/gosc/internal/sheet
internal\sheet\export.go:28:8: undefined: errors.Is
Thanks!
No, it's when try to compile. go run .
also results this
What do you mean by compile? go build .
?
Yes. The problem was the version, I'm using Go 1.12 (last one that still runs on XP). Now I've compiled it with version 1.15.3, but the problem with the non-existent cell persists.
I'm using this example:
# This data file was generated by Spreadsheet Calculator. # You almost certainly shouldn't edit it. format E 10 0 0 format F 10 2 0 format G 10 2 0 format A 10 1 0 format B 10 2 0 format C 10 2 0 format D 10 2 0 leftstring A3 = "Material" let B3 = A1*B1 let B6 = (A1*B1+(A1*10-A1*B1)+C1/30*E1+D1/40)/100*10 label C0 = "Light" label D0 = "GAS" label E0 = "Days" let A1 = 54 let C1 = 160 leftstring A7 = "Total" label B0 = "Silver" rightstring C3 = "Piece" let D3 = B3+B4 rightstring C4 = "Subtotal" let B7 = D4+B6 label A0 = "Weight" let D1 = 100 let E1 = 3 let D4 = A1*B1+(A1*10-A1*B1)+C1/30*E1+D1/40 leftstring A6 = "Guarantee" let B1 = 6.3 leftstring A4 = "Labor" let B4 = A1*10-B3 goto D4 A0
-
Technically, you can compile it using a newer Go version (anything from 1.13 upwards) and still run the final executable under XP.
-
I think it should finally be fixed :') -- I get this output with your example (the light dashes are spaces):
Sorry for the late answer...
Great!
Wow, I managed to build with version 1.12.1 !!
Great job! I do not know how to thank you.. Thank You very much!
No worries man.. this was actually fun :)
I think I might revisit this later and add some more features
Greetings!
Man, I need your help, can you email me pedroalbanese@hotmail.com? I think you will like it
Thanks!