|
One thing you could try is to read the contents of the rtf file with a streamreader and then use a streamwriter to write the data into a new html file.
Something like this:
<br />
Dim sr As StreamReader = New StreamReader("Your_RTF_file.rtf")<br />
Dim sw As StreamWriter = New StreamWriter("Your_HTML_file.html")<br />
Dim line As String<br />
Dim content As String<br />
'read data from file<br />
Do<br />
line = sr.ReadLine()<br />
If line Is Nothing Then Exit Do<br />
content += line<br />
Loop Until line Is Nothing<br />
'write data to file<br />
sw.WriteLine(content)<br />
sw.Close()<br />
Otherwise my experience with file conversion is limited, sorry.
Good luck,
Johan
My advice is free, and you may get what you paid for.
|
|
|
|
|
I was trying to make a text to speech program .for that i am writing the following code.
Public Class Form1<br />
<br />
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click<br />
If (TextBox1.Text.Trim <> "") Then<br />
TextBox1.Text = CType(TextBox1.Text.Trim, Integer)<br />
Dim no As Integer = CType(TextBox1.Text.Length, Integer)<br />
If (no <= 0) Then Exit Sub<br />
Select Case no<br />
Case 1<br />
MessageBox.Show(ones(TextBox1.Text))<br />
Case 2<br />
MessageBox.Show(tens(TextBox1.Text))<br />
Case 3<br />
MessageBox.Show(Hundered(TextBox1.Text))<br />
Case 4<br />
MessageBox.Show(Thousand(TextBox1.Text))<br />
Case 5<br />
MessageBox.Show(TenThousand(TextBox1.Text))<br />
Case 6<br />
MessageBox.Show(Lakh(TextBox1.Text))<br />
Case 7<br />
MessageBox.Show(TenLakh(TextBox1.Text))<br />
Case 8<br />
MessageBox.Show(Crore(TextBox1.Text))<br />
Case 9<br />
MessageBox.Show(tenCrore(TextBox1.Text))<br />
End Select<br />
End If<br />
End Sub<br />
<br />
Private Function tenCrore(ByVal digit As String) As String<br />
Dim str As String = ""<br />
If (Not CInt(digit.Substring(0, 2)) = 0) Then<br />
str = tens(digit.Substring(0, 2)) & " Crore "<br />
End If<br />
If (Not CInt(digit.Substring(2, 7)) = 0) Then<br />
Return str & TenLakh(digit.Substring(2, 7))<br />
Else<br />
Return str<br />
End If<br />
End Function <br />
<br />
Private Function Crore(ByVal digit As String) As String<br />
Dim str As String = ""<br />
If (Not CInt(digit.Substring(0, 1)) = 0) Then<br />
str = ones(digit.Substring(0, 1)) & " Crore "<br />
End If<br />
If (Not CInt(digit.Substring(1, 7)) = 0) Then<br />
Return str & TenLakh(digit.Substring(1, 7))<br />
Else<br />
Return str<br />
End If<br />
End Function<br />
<br />
Private Function TenLakh(ByVal digit As String) As String<br />
Dim str As String = ""<br />
If (Not CInt(digit.Substring(0, 2)) = 0) Then<br />
str = tens(digit.Substring(0, 2)) & " Lakh "<br />
End If<br />
If (Not CInt(digit.Substring(2, 5)) = 0) Then<br />
Return str & TenThousand(digit.Substring(2, 5))<br />
Else<br />
Return str<br />
End If<br />
End Function<br />
<br />
Private Function Lakh(ByVal digit As String) As String<br />
Dim str As String = CType(digit, String)<br />
Return ones(str.Substring(0, 1)) & " Lakh " & TenThousand(str.Substring(1, 5))<br />
End Function<br />
<br />
Private Function TenThousand(ByVal digit As String) As String<br />
Dim str As String = ""<br />
If (Not CInt(digit.Substring(0, 2)) = 0) Then<br />
str = tens(digit.Substring(0, 2)) & " Thousand "<br />
End If<br />
If (Not CInt(digit.Substring(2, 3)) = 0) Then<br />
Return str & Hundered(digit.Substring(2, 3))<br />
Else<br />
Return str<br />
End If<br />
End Function<br />
<br />
Private Function Thousand(ByVal digit As String) As String<br />
Dim str As String = ""<br />
If (Not CInt(digit.Substring(0, 1)) = 0) Then<br />
str = ones(digit.Substring(0, 1)) & " Thousand "<br />
End If<br />
If (Not CInt(digit.Substring(1, 3)) = 0) Then<br />
Return str & Hundered(digit.Substring(1, 3))<br />
Else<br />
Return str<br />
End If<br />
<br />
' Return ones(str.Substring(0, 1)) & " Thousand " & Hundered(str.Substring(1, 3))<br />
End Function<br />
<br />
Private Function Hundered(ByVal digit As String) As String<br />
Dim str As String = ""<br />
If (CInt(digit.Substring(0, 1) > 0)) Then<br />
str = ones(digit.Substring(0, 1)) & " Hundred "<br />
End If<br />
If (CInt(digit.Substring(1, 2) > 0)) Then<br />
If (CInt(digit.Substring(1, 2)).ToString.Length = 1) Then<br />
Return (str & " " & ones(digit.Substring(1, 2)))<br />
Else<br />
Return (str & " " & tens(digit.Substring(1, 2)))<br />
End If<br />
<br />
<br />
Else<br />
Return str<br />
End If<br />
End Function<br />
<br />
Private Function tens(ByVal digit As String) As String<br />
Dim digt As Integer = Convert.ToInt32(digit)<br />
Dim name As String = ""<br />
Select Case (digt)<br />
Case 10<br />
name = "Ten"<br />
Case 11<br />
name = "Eleven"<br />
Exit Select<br />
Case 12<br />
name = "Twelve"<br />
Exit Select<br />
Case 13<br />
name = "Thrirteen"<br />
Exit Select<br />
Case 14<br />
name = "Fourteen"<br />
Exit Select<br />
Case 15<br />
name = "Fifteen"<br />
Exit Select<br />
Case 16<br />
name = "Sixteen"<br />
Exit Select<br />
Case 17<br />
name = "Seventeen"<br />
Exit Select<br />
Case 18<br />
name = "Eighteen"<br />
Exit Select<br />
Case 19<br />
name = "Nineteen"<br />
Exit Select<br />
Case 20<br />
name = "Twenty"<br />
Exit Select<br />
Case 30<br />
name = "Thity"<br />
Exit Select<br />
Case 40<br />
name = "Fourty"<br />
Exit Select<br />
Case 50<br />
name = "Fifty"<br />
Exit Select<br />
Case 60<br />
name = "Sixty"<br />
Exit Select<br />
Case 70<br />
name = "Seventy"<br />
Exit Select<br />
Case 80<br />
name = "Eighty"<br />
Exit Select<br />
Case 90<br />
name = "Ninty"<br />
Exit Select<br />
Case Is > 20<br />
Dim str As String = CType(digit, String)<br />
name = tens(str.Substring(0, 1) & "0") & " " & ones(str.Substring(1, 1))<br />
End Select<br />
Return name<br />
End Function<br />
<br />
Private Function ones(ByVal digit As String) As String<br />
<br />
Dim digt As Integer = Convert.ToInt32(digit)<br />
Dim name As String = ""<br />
Select Case (digt)<br />
Case 0<br />
name = "Zero"<br />
Case 1<br />
name = "One"<br />
Exit Select<br />
Case 2<br />
name = "Two"<br />
Exit Select<br />
Case 3<br />
name = "Three"<br />
Exit Select<br />
Case 4<br />
name = "Four"<br />
Exit Select<br />
Case 5<br />
name = "Five"<br />
Exit Select<br />
Case 6<br />
name = "Six"<br />
Exit Select<br />
Case 7<br />
name = "Seven"<br />
Exit Select<br />
Case 8<br />
name = "Eight"<br />
Exit Select<br />
Case 9<br />
name = "Nine"<br />
Exit Select<br />
End Select<br />
Return name<br />
End Function<br />
<br />
Private Sub TextBox1_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox1.KeyPress<br />
If (e.KeyChar = "1" Or e.KeyChar = "2" Or e.KeyChar = "3" Or e.KeyChar = "4" _<br />
Or e.KeyChar = "5" Or e.KeyChar = "6" Or e.KeyChar = "7" Or e.KeyChar = "8" _<br />
Or e.KeyChar = "9" Or e.KeyChar = "0" Or e.KeyChar = Chr(Keys.Back)) Then<br />
e.Handled = False<br />
Else<br />
e.Handled = True<br />
End If<br />
End Sub<br />
End Class
for text to speech i was thinking to create a audio files for each of the following numbers.
0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,30,40,50,60,70,80,90
Now My Question is
1. Am I think right to create the audio files for each of the above numbers ?
2. Which audio extention file(.wav , mp3 .. etc ) will be useful .I meant which takes less space.
|
|
|
|
|
You also need speech for the words "and, hundred, thousand, million" etc
re: Wav or MP3 - by definition MP3 files will be smaller as it is a compressed format, but for such small files it probably doesn't make much difference. Go with wav for simplicity I say...
-------------------------------------------------
Damian - really needs to create a signature
|
|
|
|
|
Is there any way to reduce the code?
|
|
|
|
|
Probably, but unless you are willing to pay me I'm not going to do that for you.
|
|
|
|
|
wow - no-one is going to read all that.
1 - yes, you can do that
2 - well, create a wav, encode it to mp3, and see which is smaller... MP3 is obviously smaller. I believe WMA is smaller still, but they are probably quite similar.
Yes, this code is very brute force, there's no doubt you could make it a lot smaller and more elegant.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Sir, Please Provide me some tips how can i reduce the code.
Along with the code i am going to create audio file - for each words
0,1,2,3,4,5,6,7,8,9,10,12,11,13,14,15,16,17,18,19,20,30,40,50,60,70,80,90,
hundred , thousand, ten thousand, lakh, core,ten crore.
Another question is that Is there any way out to reduce the audio files .i thought to create as many audio files as i said above.
Am i thinking right?
Please provide some suggestions.
|
|
|
|
|
Build a dictionary that you can use to look up file names based on numbers instead of all those switch statements, for a start.
Nilish wrote: Another question is that Is there any way out to reduce the audio files
Not really, I don't think.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
How should I built the dictionary?
|
|
|
|
|
Why not just use the SAPI 5.1[^] API library??
|
|
|
|
|
hi,
i have two buttons in my form - named button1 and button2.now in the following handler , can i add the two button click events?
like
private sub button_click(byval sender as system.objects , byval e as system.eventargs)handles button1.click , button2.click
end sub
|
|
|
|
|
If clicking the two buttons causes the same code to execute, why do you need two buttons?
-------------------------------------------
Damian - Man of changing signature.
|
|
|
|
|
No, further i want to do code to distinguish between two button , whether i have clicked button1 or button2 .Is it possible???????
|
|
|
|
|
|
I did not get the meaning of
DirectCast(sender, Button)
Private Sub LotsOfButtons( _
ByVal sender As System.Object, _
ByVal e As System.EventArgs) _
Handles Button1.Click, Button2.Click, _
Button3.Click, Button4.Click, _
Button5.Click, Button6.Click, _
Button7.Click, Button8.Click, _
Button9.Click, Button10.Click
Dim clickedBtn As Button
If TypeOf sender Is Button Then
clickedBtn = DirectCast(sender, Button)
MsgBox(clickedBtn.Text)
End If
End Sub
Should i imports any framework class to use this function?
|
|
|
|
|
is DirectCast(sender, Button) some sort of CTYpe(sender,button) ?
If yes then DirectCast is any predefined function??????
|
|
|
|
|
|
Making the two function either it is user define e.g
private sub button1_click(byval sender as system.objects , byval e as system.eventargs)handles button1.click
and Change the Name Of Second Function and replace the Handeler name Button2
Please try it
|
|
|
|
|
by using the following code you can distinguish between the two buttons
Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click, Button5.Click
Dim btn As Button = CType(sender, Button)
If btn.Text = "ASDFS" Then
Else
End If
End Sub
shally
|
|
|
|
|
I would like to be able to modify data a program uses for calculations and have it remain as default for the next time the program runs. I can't think of a way to do this with out using a seperate ini or cfg file. If someone could give me a clue I would appreciate it.
thanks
bill a.
|
|
|
|
|
You can use a config file, XML file, Registry, or Isolated Storage. You have to put it somewhere. it's up to you where that somewhere is and the format of the file you write.
|
|
|
|
|
|
I suspected that was the only way. I can remember vaguely using a "poke" command to push data back into a compiled executable from the executing program, but that was using assembly language on a very old machine. I was kind of hoping that VB had an easy way of defining a storage structure within the program that could be modified on the fly.
thanks
bill a.
|
|
|
|
|
I want to give my user the ability to copy a list of Orders (based on MR # and PreviousVisitDate) to a new VisitDate when they are creating one. So this is what I have to do..
1. Select all Orders with the specified MR and PreviousVisitDate
2. Copy all of the returned records (to a new temp table??)
3. Change the Date in the returned records to the New Date they entered.
So now I will have the original list and the new list that looks just like it but with a different Date.
I am sure this is simple for most of you but I am struggling with it. Can anyone show me an example of how this would be done or point me to one that I can read through? Thanks for any help you can give me with this.
|
|
|
|
|
How this is done depends on your existing implementation. How are the records being selected? In what control are they displayed? Is this control bound to a DataSet?
If the displaying control is bound to a dataset, then the items returned by its SelectedItems property should be DataRow objects. All you would have to do is change the date in each DataRow, then possibly write the in that DataSet back to the database.
If not bound, then you would have to get the record ID numbers from the SelectedItems of your control and make the changes to the database using Sql statements, or whatever else you're storing this data in.
I can't give you a more consise answer, because we know nothing of your existing implementation.
|
|
|
|
|