|
-
Jun 27th, 2006, 03:56 PM
#1
Thread Starter
Hyperactive Member
text with layout
hello, I have an application that we have used for 6 years. It relied on opening word(97 or 200) and then save as "text with layout"
well in 2003 and the current security "fixes" it seems that text with layou (*.ans) is no longer available.
The goal is to get a plain text file that has spaces for paragraph indents and tabs. Each line has a CR/LF to eliminate word wrap.
the source file is an RTF that is opened in word for the user to edit.
the plain text file is imported into our cad software.
It can't read the rtf directly as the source file exceeds its maximum file size for importing.(autocad)
I have tried saving as text with CR/LF which give me the text, but I loose the indenting. Headings are left justified with sub paragraphs over 0.2" and then sub-sub over 0.4" and so on.
the indenting is extremly important as it seems like a huge mess of text without some logical indentations.
any help is appreciated.
thanks
I am so skeptical, I can hardly believe it!
PS I am not a 'hyperactive member' I am a cool, calm, and collected member 
-
Jun 27th, 2006, 03:59 PM
#2
Addicted Member
Re: text with layout
I recently had to program a LUA file that was picky on identing and how it read saved variables.
I ended up using "vbTab". While I'm not sure this will satisfy what you'd like to do, and it makes your code ugly, but that is what I had to do.
-
Jun 27th, 2006, 04:00 PM
#3
Thread Starter
Hyperactive Member
Re: text with layout
could you expand on what you did?
do you mean vbTab as the compiler constant?
I am so skeptical, I can hardly believe it!
PS I am not a 'hyperactive member' I am a cool, calm, and collected member 
-
Jun 27th, 2006, 04:09 PM
#4
Addicted Member
Re: text with layout
 Originally Posted by badgers
could you expand on what you did?
do you mean vbTab as the compiler constant?
This is assuming what I'm following what you're asking.
You want to be able to write to a file, but the file must have a format.
For example..
VB Code:
Data1
Data2
Data3
Data4
Data5
Data6
Data7
Am I following you correctly?
-
Jun 27th, 2006, 04:14 PM
#5
Thread Starter
Hyperactive Member
Re: text with layout
yess, but the Data2 - Data 6is indented by only spaces
there is a hard return at the end of each line.
and the source for Data1 - Data 7 is a rich text file that uses paragarph indentations to push Data2- data 6 over. There are also numbered lists that the rich text file manages. This does not change much so I could manually number the lists if it needed it
thanks
I am so skeptical, I can hardly believe it!
PS I am not a 'hyperactive member' I am a cool, calm, and collected member 
-
Jun 27th, 2006, 04:33 PM
#6
Addicted Member
Re: text with layout
Well, what I was getting at is..
VB Code:
Dim s as String
s = "Data1" & vbCrLf
s = s & vbTab & "Data2" & vbCrLf
s = s & vbTab & "Data3" & vbCrLf
s = s & vbTab & vbTab & "Data4" & vbCrLf
s = s & vbTab & "Data5" & vbCrLf
s = s & vbTab & "Data6" & vbCrLf
s = s & "Data7"
You said..
yess, but the Data2 - Data 6is indented by only spaces
Is this how you want it to be, indented by spaces?
If that is the case, a simple loop could do that. Hopefully my 3 day weekend didn't make me too lazy, I hope I'm getting you an answer you seek.
-
Jun 27th, 2006, 04:45 PM
#7
Thread Starter
Hyperactive Member
Re: text with layout
I appreciate your help but that is not what I was trying to do.
text is already indented.
I want to take a microsoft word document and make a text file that has only spaces and CR/LF at the end of each line.
that is going backwards for me.
Thanks again and have a good day
I am so skeptical, I can hardly believe it!
PS I am not a 'hyperactive member' I am a cool, calm, and collected member 
-
Jun 27th, 2006, 05:03 PM
#8
Addicted Member
Re: text with layout
Oh, ahah, well finally I understand what you're saying.
Without the source file, nor with really testing, you can give this a shot.
VB Code:
Public Function ConvertRTF(ByVal rtfTextBoxName As RichTextBox) As String
ConvertRTF = rtfTextBoxName.Text
End Function
You'd have to load (or copy) the RTF into the control, and then run that function. I recall having to do something like this in the past, but it was a few years ago.
If that doesn't do it, I'll have to think about it a little more. Sorry for wasting your time eariler, but was having a hard time understanding the situation.
-
Jul 7th, 2006, 11:45 AM
#9
Thread Starter
Hyperactive Member
I am so skeptical, I can hardly believe it!
PS I am not a 'hyperactive member' I am a cool, calm, and collected member 
-
Jul 7th, 2006, 01:50 PM
#10
Re: text with layout
1) You can only indent in whole character amounts in a text file. There's no such thing as .2" unless your input device recognizes some form or printer control language that has inch spacing commands. "Paragraphs" are an artifact of the program displaying or printing the text. So are fonts.
2) The easiest way to do this is brute-force - get the text and add spaces and hard CRs where you want them.
The most difficult part of developing a program is understanding the problem.
The second most difficult part is deciding how you're going to solve the problem.
Actually writing the program (translating your solution into some computer language) is the easiest part.
Please indent your code and use [HIGHLIGHT="VB"] [/HIGHLIGHT] tags around it to make it easier to read.
Please Help Us To Save Ana
-
Jul 7th, 2006, 10:48 PM
#11
Thread Starter
Hyperactive Member
Re: text with layout
 Originally Posted by Al42
1) You can only indent in whole character amounts in a text file. There's no such thing as .2" unless your input device recognizes some form or printer control language that has inch spacing commands. "Paragraphs" are an artifact of the program displaying or printing the text. So are fonts.
2) The easiest way to do this is brute-force - get the text and add spaces and hard CRs where you want them.
this is a rich text file that is edited in word. The sample I posted is a striped down version because the real document is 100K.
you are correct that a text file does not have .2" indent but the document format in Word does. That is the whole point of this, I need to put in blank spaces but I can't figure out WHERE I WANT THEM
this is a dynamic living document, the document could be changed by the supervisor at 8:01 am and the person who loads this at 8:02 am will get the new version.
I have to read the rich text file and determine what is indented and how much, so I can add the right amount of spaces.
In Word 2000 there was a save as "text with layout" that did this very well.
Word 2003 has had that conversion removed. Microsoft listed it as a security risk
http://help.lockergnome.com/office/W...ict609328.html
I am so skeptical, I can hardly believe it!
PS I am not a 'hyperactive member' I am a cool, calm, and collected member 
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|