About the problem of merging independent RTF files

Source: Internet
Author: User

has been very confused, how to merge two RTF files, use the common method of merging, the merged file is very large, and the content is only the first file, I think it is due to the end of the file, even with the copy function, the resulting merged file, although a little, However, the displayed content is the same as the file that is merged in the code. Because files are mixed in text, merging a string is not feasible, and then always looking for methods.

The best way to find this is to read RTF into RichTextBox, a display object, an object created during the run, an object created during the run that only needs loadfile, then select All, then use SELECTEDRTF, It is not troublesome to paste on the displayed object after the copy, but I always think it is not the best way, but at present there is no good way, who let me have no idea about file operation. Difficult and difficult.

Copy and paste the following code:

Public Shared Function Rtffilemerge (ByVal firstfile As String, ByVal Secondfile as String) as Boolean
Dim Rtb1 as New RichTextBox
Dim RTB2 as New RichTextBox
Dim Rflag as Boolean = False
Try
Rtb1. LoadFile (Firstfile)
Rtb2. LoadFile (Secondfile)
Rtb2. SelectAll ()
Rtb2. Copy ()
Rtb1. AppendText (CHR (13))
Rtb1. Paste ()
Rtb1. SaveFile (Firstfile)
Rtb2. Dispose ()
Rtb1. Dispose ()
Rflag = True
Catch ex as Exception
MessageBox.Show (ex. Message)
End Try
Return Rflag
End Function

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.