Textbox and/or RTB Templates
I've never seen anything on this.
Anyone how you go about making a template for a textbox/RTB, such that when you load an unformatted file into the textbox, the text becomes formatted.
My definition of "formatted" for this post means proper indenting in accordance with the template.
Thanks
David
Re: Textbox and/or RTB Templates
Quote:
Originally Posted by dw85745
I've never seen anything on this.
Anyone how you go about making a template for a textbox/RTB, such that when you load an unformatted file into the textbox, the text becomes formatted.
My definition of "formatted" for this post means proper indenting in accordance with the template.
Thanks
David
I think it's just as simple as loading a pre-saved RTF file.
(Normal textbox doesn't support formatting!)
VB Code:
Dim TemplatesFolder As String
TemplatesFolder = "C:\My Templates"
RichTextBox1.LoadFile TemplatesFolder & "\MyFirstTemplate.rtf"
Pradeep :)
Re: Textbox and/or RTB Templates
I have done formatting in Word, to create tables, and a picture box holder. I save it as a .RTF, and load it into my RTB control. In the file, I have [1],[2],[3]
so that when it's loaded into the control, it's the template. Then I use .Select "[1]" to find the first placeholder, and then paste in the formatted field.
I do this for 45 fields, and even paste in an image before I print it.
You can do formatting for each field, and my receipt comes out correct every time.
Then, I just print it out.
Re: Textbox and/or RTB Templates
Thanks for responses guys.
Best way I can explain what I want to do is:
Say I have an text file which groups my text under each XML tag.
dglienna -- this would be the same as your [1] tag.
If I indent my XML tags programically I also want the text to be
programically indented under the XML tag. If the text for any
specific XML tag wraps, I want the next line of text to also be indented at the same level as the XML tag.
Sorry the below quote won't keep indenting but each tag is indented and
the text line is indented under Tag3.
VB Code:
For example:
[Tag1]
[Tag2]
[/Tag2]
[Tag3]
<Text starts here and goes to end of textbox/RTB
<text starts her and goes to end of textbox/RTB
<text starts her and goes to end of text
[/Tag3]
[/Tag1]
Where the problem lies is programically getting the second, third, etc. text lines to indent. The only way I can see it is do a character count and compare this to the textbox width. Then force a Tab.
Re: Textbox and/or RTB Templates
You could try to create the hanging indents in the Word document to see if the rtb control recognizes it.
Re: Textbox and/or RTB Templates
dglienna
I know the RTB will handle indents (tags) as well as a Textbox.
Where my hangup is ---- "whatever the meaning of is is :bigyello: " ----
is that I need to do all indenting programmically (not manually) since I have
a number of files, of which each may/may NOT have text that
will wrap or some may wrap more lines than others.
If this is doable in Word -- as you indicate -- a small example or snippet would be appreciated.
David
1 Attachment(s)
Re: Textbox and/or RTB Templates
I've set up field [1] with a hanging indent, one more than the others. When I replace it with a wrapped line, the line wrapped is also indented.
I loaded it into Wordpad and used Find/Replace to make sure it worked the way that I expected it to.
Re: Textbox and/or RTB Templates
Thanks dglienna will take a look see.
BTW: What's this rating business they started in the forum?
Does rating ultimately result in money, a prize, or just personal
satisfaction that one did a good job?
Will be glad to rate you, when done this thread, if your desires?
David
Re: Textbox and/or RTB Templates
dglienna
Interesting idea to use MSWord with preset tags and then do a search/replace of tags to make and format a file.
Let me know what I need to do to give you points and how many you would consider acceptable for your help on this?
Thanks
David