line breaks in textareas

line breaks in textareas

Forum member · Jan 13, 2009
Hi, we're evaluating this product, is is possible to: a) have nonbreaking space in a textarea b) have a newline break in a textarea These are critical to our eval so please let me know as soon as possible. Thx, Rick Piovesan Detaya Corp

Re: line breaks in textareas

Support · Jan 14, 2009
Hello Rick, You can accomplish both, add a non breaking space as well as new line when adding text to the TextArea using the sample code below: Document document = new ceTe.DynamicPDF.Document(); Page page = new Page(); document.Pages.Add(page); string text = "Hello ASPX C#\u00A0World...\nFrom DynamicPDF™ Generator for .NET\nDynamicPDF.com"; TextArea area = new TextArea(text, 100, 100, 200, 200); page.Elements.Add(area); Thanks, ceTe Software Support Team

Re: line breaks in textareas

Forum member · Jan 14, 2009
Hello, I tried "Hello\nWorld" as the string text loaded into a textarea, and the result in the displayed textarea was simply "Hello\nWorld" just like that. So doesn't seem to be working?

Re: line breaks in textareas

Support · Jan 14, 2009
Hello, I tried the following code and it put Hello and World on two seperate lines: string text = "Hello\nWorld"; TextArea area = new TextArea(text, 100, 100, 200, 200); Can you please post the sample code you used if you do not see the desired behavior and we can take a look at it. Thanks, ceTe Software Support Team

Re: line breaks in textareas

Forum member · Jan 14, 2009
Here is code - results in "Hello\nDoggy" to be displayed on page: Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load Dim MyDocument As Document = New Document() Dim MyPage As ceTe.DynamicPDF.Page = New ceTe.DynamicPDF.Page() Dim t As New TextArea("Hello\nDoggy", 30, 30, 80, 80) MyPage.Elements.Add(t) MyDocument.Pages.Add(MyPage) MyDocument.DrawToWeb(False) End Sub Regards, Rick.

Re: line breaks in textareas

Support · Jan 14, 2009
Hello, In VB.NET use the following string as text: Dim Text As String = "Hello ASPX VB.NET World..." & vbCrLf & "From DynamicPDF™ Generator for .NET" Thanks, ceTe Software Support Team

Re: line breaks in textareas

Forum member · Jan 14, 2009
THANK YOU - this works. I'm not impressed that this is not documented anywhere in your product (or on this forum) - this is a *very* standard VB type of thing .. do you mean then that such a majority of your users are C# that there's no need for noting VB particularities? (but if so though, then why are all the examples in VB and not C#). Anyhow, it works, so on to other things: a) the Unicode sequencing suggested earlier for non-breaking spaces doesn't work .. could this possibly be yet another VB-specified issue? b) this use of Unicode .. does it imply then that any Unicode sequence will work, like I can go to Charmap and get a 'degree' or other symbol and poof it should work? (because it doesn't). c) Page numbering doesn't work. I copied the sample code, and instead of page numbering, I just got the cryptic sequence spit back out on the bottom of the page: "/%/%PR/%/%/%/%SP/%/% of /%/%ST/%/%" - here's the code: Private Sub doGenerate() MyDocument = New Document() Dim documentTemplate As Template = New Template() MyDocument.Template = documentTemplate ' Page numbering .. documentTemplate.Elements.Add(New PageNumberingLabel( _ "/%/%PR/%/%/%/%SP/%/% of /%/%ST/%/%", 0, 680, 512, 12, Font.Helvetica, _ 12, TextAlign.Center)) MyPage = New ceTe.DynamicPDF.Page() DoGenerate_PageLayout() DoGenerate_Page1() MyDocument.Pages.Add(MyPage) MyDocument.DrawToWeb(False) End Sub Your help is still greatly appreciated. Regards, Rick.

Re: line breaks in textareas

Support · Jan 14, 2009
Hello Rick, In the Help Documentation we have sample examples for both C# and VB.NET. Also there are examples included with the download that includes both # and VB.NET. Maybe you have VB filter on in the help documentation and thats the reason you only see VB samples. To add non breaking space in VB.NET, you will need to convert the Hex value to decimal and pass it to the ChrW() function. For C# you can just use "\uXXXX". The reason you are nt seeing page numbering is becasue you are using wrong page numbering tokens. Use the below line and it will dsiplay the page numbers: documentTemplate.Elements.Add(New PageNumberingLabel( "/%/%CP/%/% of /%/%TP/%/%", 0, 680, 512, 12, Font.Helvetica, 12, TextAlign.Center)) CP stands for Current Page and TP stands for Total number of pages. Thanks, ceTe Software Support Team