Carriage Return and Line Break - InfoPath Dev
in

InfoPath Dev

Carriage Return and Line Break

Last post 07-10-2009 01:11 AM by lilmaster. 4 replies.
Page 1 of 1 (5 items)
Sort Posts: Previous Next
  • 07-08-2009 11:07 PM

    Carriage Return and Line Break

    Hi,

    In InfoPath, I've a rich text box. I want to get the first line and other lines separately. I used the following code:

    if (niAgenda.Current.HasChildren)
    {
        XPathNodeIterator niDiv = niAgenda.Current.SelectChildren(XPathNodeType.Element);
            for (int j = 0; j < niDiv.Count; j++)
            {
                niDiv.MoveNext();
                    if (j == 0)
                        vEvent.Summary = niDiv.Current.Value;
                    else
                        vEvent.Description += niDiv.Current.Value + System.Environment.NewLine;
            }
    }

    It works fine while debugging in visual studio. But niDiv.Current.Value is different in SharePoint.

    How can I achieve?

  • 07-10-2009 12:34 AM In reply to

    Re: Carriage Return and Line Break

    Hi Lil Master,

    What are you actually trying to do? Writing code and trying to edit/parse rich text fields, is ABSOLUTELY NOT a best practice. You should not have to do that. We never do. But, please explain your scenario. Maybe you have a special case.

    Thanks!

    Patrick Halstead
    Project Manager at Qdabra
  • 07-10-2009 12:44 AM In reply to

    Re: Carriage Return and Line Break

    Hi,

    Actually, I'm creating a schedule using InfoPath web forms. For an event, there will be start time, end time, agenda, participants, status, location, etc. And I'm attached calender (.ics), storing those events.

    Then, rich text box is used for entering agenda. The first line of the agenda will be the summary in calendar file and the remaining line of agenda + participants will be description in calendar.

    So, I'm trying to get the first line and remaining line of rich text box. In fact, I'm not trying to edit the rich text fields. I want to expose as calender file.

    Thanks!

  • 07-10-2009 01:00 AM In reply to

    Re: Carriage Return and Line Break

    Thanks for explaining.

    Don't use rich text for this. Use structured XML. XHTML (aka rich text) is not structured and it will be very difficult for you to consistently parse it.

    If you are trying to generate an agenda (vs. parse it), same applies. It's much easier to generate structured XML.

    Define your agenda schema and use that. Don't use rich text. Rich text is not meant to be a substitute for XML schemas. It is meant for formatted text only.

    Sorry to rain on your parade, but you are trying to do something that is ridiculous.

    Best regards,

    Patrick Halstead
    Project Manager at Qdabra
  • 07-10-2009 01:11 AM In reply to

    Re: Carriage Return and Line Break

    Thanks for your suggestion.

    Cheers!

Page 1 of 1 (5 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.