String output to MS-WORD has too many new lines - ms-word

This is my program window... The box in questions is the one labeled "INVESTIGATION" and "DISPOSITION".
When text is entered into the multiline textbox it is output in the DOCX file and it adds extra new lines... If a line is entered right below the original line it is a single extra new line. If it is spaced by one line it adds in two new lines. I figure it is something with the textbox properties or the output argument not playing well with the string. I have included pictures of the Form as it looks to the user. The builder code. The word document which shows the problem and the textbox properties. I want new lines in the investigation and disposition textbox to display how they are in the GUI and not have the extra new line. Any pointers?
I cant post images yet but you can view the images at the DOCX discussion board here https://docx.codeplex.com/discussions/658603
I hope its clear that I want it to display just as it is in the GUI:
A
A
A
should not look like it does in the last image where it is:
A
A
A
Thanks for all the help!

Related

How do I get OpenOffice Writer Combo boxes to display multi-line text?

I am developing an OpenOffice Writer template that can be used to fill in reports for a child-care centre.
There are some standard outcomes, comprising long sentences, and I want the user to be able to select the appropriate sentence from a combo box. I have entered the sentences into a table in Openoffice Base database, which is then connected to a series of combo boxes in a Writer template. However, when the user choose an option that contains a very long sentence, only the text up to the length of the combo box is visible.
What I want to do is have the selected value of the combo-box wrap over several lines when selected so that all the (very long) text appears in the selected box when the user chooses a long sentence from the combo.
I have been looking through the properties of the combo box control, but have yet to identify one that will allow the selected value in the combo box to word-wrap (so that I could make the combo-box several lines in height such that the entire sentence would fit into the box).
Any pointers on how I could do this would be much appreciated.
thanks,
David.
Thanks Jim K, that was helpful. In the end, what I wound up doing was creating a textbox which I named "selectedOutcomeATextBox" immediately below my combo box which was named "OutcomeCombo".
I then attached the following macro code to the textModified event associated with the "selectedOutcomeATextBox":
Sub UpdateOutcomeA
Dim Doc As Object
Dim Form As Object
Dim Ctl As Object
Dim newCtl as Object
Doc = ThisComponent
Form = Doc.DrawPage.Forms.GetByIndex(0)
Ctl = Form.getByName("OutcomeCombo")
newCtl = Form.getByName("selectedOutcomeATextBox")
newCtl.Text = Ctl.Text
End Sub
I also set the "Printable" property of the "OutcomeCombo" to "No", so that when the document prints, the combo box itself does not appear on the printed page, but the "selectedOutcomeATextBox" textbox which has had its value set by the macro when I choose a value from the combo box does appear with the desired text. I also set the "TextType" property of the selectedOutcomeATextBox" text box to "Multi-Line", so that extra long text will wrap to the next line, thereby showing the very long strings that are stored there.
Thanks heaps Jim K.
cheers,
David Buddrige
Apparently combo boxes do not have the MultiLine attribute. The question was asked a few years ago here but was not solved.
One alternative that requires some macro programming is to use a single multi-line text field and then make a scroll bar button that changes the choice. Instead of a scroll bar, two buttons could be used to change the choice (Previous / Next), or even a list box control. Using a list box control in this way would have the advantage that they could see all the choices at once, like a combo box.
Another approach is to break up each sentence and display the parts across several lines of a list box. Then when one line is clicked, all the lines of a sentence are selected at once, using an event listener for the list box. This could be shown in addition to an ordinary editable multi-line text box, in case none of the answers in the list are wanted.
One more idea: Radio buttons can have multiple lines, so dynamically show radio buttons, one for each sentence. A dialog window could be displayed to hold the radio buttons. The result of the dialog would be used to fill the multi-line text field.
Or you could just live with the truncated sentences. Maybe it would help to make the control a little wider, or abbreviate the sentences.

How to display Text in new line in CoDesys visualization

In CoDeSys visualization, how to display Text in newline.
I have a csv file which reads by CoDeSys and display the csv column text in CoDesys rectangle text block.
In csv file I tried giving $N, \n\r,\n, no chance
To define a new line you have to type '$N'. Example: 'Hello$NWorld'
I hope it works!
From:
http://infosys.beckhoff.de/english.php?content=../content/1033/TcPlcControl/HTML/TcPlcVisu_edit_configElement.htm&id=
one learns:
"With the key combination Crtl+Enter you can insert line breaks, with Crtl+Tab, tab stops."
So, press Crtl+Enter to start a new line and check how CoDeSys separates lines. Hope it helps.

tinymce removes line breaks so all text is in a continuous chunk with no paragraphs

I'm using TinyMce textarea editor and have a problem. As you probably know Tinymce transforms a standard html textarea into a rich text editor.
On our 'edit listing' page we call up some text from our db for the user to edit (previously in a standard textarea, now in the tinymce textarea.
Previously the standard textarea would preserve linebreaks and the user would get several paragraphs of text in the text area, now with tinyMCE they get a huge chunk of text with no linebreaks. (I have pasted an example of an entry in our db below - as you can see it has line breaks in it by tinymce seems to be ignoring them when it displays them in the editor).
Just to clarify my issue is now that tinymce is stripping something when I submit the form, it's that when I pull text (that contains line breaks) from the db and populate the tinymce textarea with that data (for the user to edit) in the tinymce textarea - the text appears (in the tinymce textarea) as one massive chunk of text with my paragraphs (whereas in a standard textarea it is nicely formatted with linebreaks)
Any help on how to resolve this would be greatly appreciated - do I need to use some sort of populate() type function to put the text in, or maybe I need to replace all the linebreaks with a different special character that tinyMCE will recognise as a line break and preserve?..
Thanks in advance.
Nick
example from db:
Here is line one
Here is line two
And here is line three
Which appears in tinymce as:
Here is line one Here is line two And here is line three
I faced a similar a problem, a while back and had questions just like yours. Also I finally ended up on SE just like you.
Anyway, I think I have the solution to your problem. If you are using PHP as your server side language, then you should use nl2br() PHP function.
Suppose you have stored your content fetched from the database in a php variable. Something like this:
$content = $row['content'];
Now when displaying it on to your screen, use the nl2br() function.
echo nl2br("<p>".$content."<p>");
Now, this part inside () depends on how you want to output the data. And I will leave it to you to figure that part out.
Hope this helps.

How can i create a textarea that has read and write lines using gtk

Any one know how i can create a text area which displays lines of text which can not be edited but allows you to edit the bottom most line for text.
basically in a similar fashion to embedded consoles inside applications that allow you to run code direct on the application.
currently using a textview i can go and edit the code above and the output response are also editable.
It's possible using a GtkTextView, but not trivial. You have to create a tag that makes the text uneditable, and apply it from the beginning of the buffer to just before the end position. Then when you receive and process input, extend or re-apply the tag to cover that line of input and your program's response to it.
Here's an example of it being done:
creating the tag
applying the tag

Matlab text object carriage return issue + text outside graph

I'm trying to show some text on top of a plot. Using
text(13,15200,('~ 12h'),'HorizontalAlignment','right','VerticalAlignment','middle','FontSize',10,'FontAngle','italic');
I can create the text box how I want it. But a thing I didn't manage to do is to create a carriage return within that text object. Already tried to add '\r' or '\n' but the only thing I get is the display of '\r' or '\n' with out breaking the line. Any ideas?
And i now that text object are used to put text WITHIN axes. But I am still trying to find a way to put some text outside the grap. Searching stackoverflow I found this Post about using UICONTROL. It works great but when I export to EPS the text seems to be in pixel format and NOT vector - so it looks really bad. Is there another way besides using uicontrol??
Thanks a lot for help!
In text that is not interpreted, you can specify line breaks using the carriage return character, which has the ascii code 10.
text(x,y,sprintf('break after this%snew line here',char(10)));
To allow text outside axes, you need to turn off clipping for the text object
text(x,y,.....,'clipping','off')