Intermediate
Date of registration: Jan 1st 2009
Location: Hanover, Germany
Occupation: Software Engineer
Hobbies: Hilbert Curves
Source code |
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
Option Explicit Import javax#swing#text#rtf Public Sub Command1_Click() Dim kit As RTFEditorKit Dim doc As DefaultStyledDocument Dim fis As FileInputStream kit = Cast(RichTextBox1.Parent.getEditorKitForContentType("text/rtf"), RTFEditorKit) doc = Cast(kit.createDefaultDocument, DefaultStyledDocument) fis = New FileInputStream(New File("test.rtf")) Call RichTextBox1.Parent.setEditorKit(kit) Call kit.read(fis, doc, 0) Call RichTextBox1.Parent.setDocument(doc) fis.close End Sub |
This post has been edited 1 times, last edit by "A1880" (Jul 22nd 2009, 12:27pm)
in Jabaco klick the menuitem "Project"->"References (Classpath)"Quoted
the DefaultStyledDocument class was not found
Jabaco Source |
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
Import javax#swing#text Import javax#swing#text#rtf Public Sub Command3_Click() CommonDialog1.ShowOpen If CommonDialog1.IsCanceled Then Exit Sub RichTextBox_LoadFile(RichTextBox1, CommonDialog1.FileName) End Sub Public Sub RichTextBox_LoadFile(RTB As RichTextBox, aFileName As String) Dim fis As New FileInputStream(aFileName) Dim doc As New DefaultStyledDocument(New StyleContext) Dim kit As New RTFEditorKit RTB.Parent.setEditorKit(kit) RTB.Parent.setDocument(doc) kit.read(fis, doc, 0) fis.close End Sub |
Jabaco Source |
|
1 2 3 4 5 6 7 8 9 10 |
Public Sub SingleLoad(FilePath As String) Dim FF As VBFileHandler Dim LineText As String FF = Open(FilePath) Do Until FF.EOF LineText = ReadLine(FF) TextMain.Text = TextMain.Text + LineText Loop FF.close() End Sub |
This post has been edited 1 times, last edit by "klctal" (Aug 13th 2009, 10:07am)