Value obtained from excel containing linebreak doesn't retain the linebreak

Hi, I’m trying to paste a value from excel into a field in an online form. The value contains one or more line breaks but when keying it into the intended field it always omit the line break. Appreciate the help. Thanks in advance.

Hello @QTH

Assign cellValue = YourExcelDataTable.Rows(0)(“YourColumnName”).ToString
Assign modifiedValue = cellValue.Replace(Environment.NewLine, “#”)

Type Into yourFormTextField with modifiedValue

Thanks & Cheers!!!

Hi @QTH

How about the following?

Input="jhsdfsh

sdgssuh

jhdshsusuhd

jhbsjhbshdsh"

Final=Input.ReplaceLineEndings(" ")

Hope this helps!!

When I write line both line still shows as with linebreak. But when written directly into the field it still doesn’t take in the line break so it ended up as a single line.

It says ReplaceLineEnding is not a member of string. Are you using studiox?

@QTH

No, it is studio only

Can you show the screenshot how you are using

Can you please recheck it is ReplaceLineEndings

Final=Input.ReplaceLineEndings(" ")

Confirmed. I copied your code and pasted it in. Perhaps a dependency issue.

we assume entering an enter will do the line break

Give a try at the following (Assumption: Type Into Activity)

strNew = YourStringVar.Replace(Environment.NewLine, "[k(enter)]")

Also check if from excel not a line break in the format of \r\n is returned and check also for

strNew = YourStringVar.Replace(vbLf, "[k(enter)]")
Or
strNew = YourStringVar.Replace(vbCr, "[k(enter)]")

@QTH

  1. Assign activity:
    existingChoices = YourListItems(“MultipleChoices”).ToString.Split(";"c, StringSplitOptions.RemoveEmptyEntries).ToList()

  2. Modify existingChoices as needed, e.g., add or remove choices

  3. Assign activity:
    updatedChoices = New System.Text.StringBuilder()

  4. For Each activity (TypeArgument: String, Values: existingChoices):
    a. Assign activity:
    updatedChoices.AppendLine(item)

  5. Update List Item:
    Input: List Item ID, Site URL, List Name
    Fields: “MultipleChoices” = updatedChoices.ToString()