WPF에서 .rtf 또는 .doc를 flowdocument로 어떻게 표시 할 수 있습니까?
-
06-07-2019 - |
문제
응용 프로그램의 도움말 섹션을위한 것입니다. 도움말 문서를 표시하기 위해 FlowDocumentReader를 넣을 생각입니다. 그러나 flowdocument에 표시 할 .rtf 또는 .doc를 표시 할 수 있습니까? 도와주세요.
감사,
해결책
이 라인의 무언가는 DocumentPath가 RTF 파일 경로 인 경우 작업을 수행합니다.
FileStream fileStream = File.Open(documentPath, FileMode.Open, FileAccess.Read, FileShare.Read);
FlowDocument flowDocument = new FlowDocument();
TextRange textRange = new TextRange(flowDocument.ContentStart, flowDocument.ContentEnd);
textRange.Load(fileStream , DataFormats.Rtf);
그래도 오류 확인 코드를 추가하십시오.
제휴하지 않습니다 StackOverflow