HTML을 RTF 및 기타로 변환하는 클래스를 제공하는 제 3 자 라이브러리 (데모, 지원을받을 수 없으므로 데모)를 사용하려고합니다. 문제는 ' m using은 System.Io.Stream
이 RTF 변환을 저장하려고하지만 올바르게 설정하지 못했기 때문에 스트림이 여전히 비어 있습니다.스트림과 관련된 간단한 문제
Stream 객체를 올바르게 사용할 필요가 없기 때문에 Stream을 사용할 필요가 없기 때문에 Stream의 사용법에 대해 빠뜨린 것 같습니다.
내가 뭘 잘못하고있어?
Imports Nasosoft.Documents.Transform
Imports System.IO
Public Class Form1
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Shown
' Set the Stream.
Dim RTFStream As Stream = Stream.Null
' Create a HtmlToRtfTransform
Dim Converter As HtmlToRtfTransform = New HtmlToRtfTransform()
' Load an HTML file.
Converter.Load("C:\File.html", System.Text.Encoding.Default)
' Transform it into a stream
Converter.Transform(RTFStream)
' Transform it into a file
' Converter.Transform("C:\File.rtf") ' This works well.
' Dispose the object.
' Converter.Dispose()
MsgBox(RTFStream.Length) ' Result: '0' ...
' I try to read the contents of the Stream
Dim StrReader As New StreamReader(RTFStream)
MsgBox(StrReader.ReadToEnd) ' But there is nothing to see.
End Sub
End Class
스트림이 null이며 파일에 설정되지 않습니다. 어쩌면 – OneFineDay
@DonA 아니요, * null *이 아닙니다. 그것은'/ dev/nul'입니다; 영원한 연하의 틈 –