Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parsing for the "alt return " character. ? #133

Closed
joeblew99 opened this issue Oct 9, 2017 · 2 comments
Closed

Parsing for the "alt return " character. ? #133

joeblew99 opened this issue Oct 9, 2017 · 2 comments

Comments

@joeblew99
Copy link

I have this in a cell:

"
We need this to store valuable building materials, so do this first.
Demolish internal rear wall
and check depth of garage. Hopefully is deep enough and door openings are wide enough.
Remove middle wall
Laminate existing main roof timbers
Demolish wall
"

This is written using the ALT return to make a carriage return within the cell.

Anyone know how to parse this ?

@xuri
Copy link
Member

xuri commented Oct 10, 2017

Reference issue #69, this lib not support set multiline texts for a cell currently.

@joeblew99
Copy link
Author

@xuri

I got it working myself:

if cellValue != "" {

				// Split on carriage return.
				cellSplitArray := strings.Split(cellValue, "\n")
				cellSplitNewArray := cellSplitArray

				// Loop
				for i := range cellSplitArray {
					//log.Print(fmt.Sprintf("split index (%v) Value %s ", i, cellSplitArray[i]))

					//newValue := fmt.Sprintf("%s_%s", cellSplitArray[i], "_changed")

					newValue, err := lang.Translate(cellSplitArray[i], langID)
					if err != nil {
						return err
					}

					cellSplitNewArray[i] = newValue

				}

				// rejoin array
				newValue := strings.Join(cellSplitNewArray, "\n")

				s.SetCellValue(sheetName, cellAxis, newValue)

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

No branches or pull requests

2 participants