Congratulations - C# Corner Q4, 2022 MVPs Announced
Why Join
Become a member
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
C# Corner Home
Technologies
Monthly Leaders
ASK A QUESTION
Forum guidelines
Erwin Alcantara
2.1k
18
1.1k
w can I unload xps file in documentviewer
Sep 30 2019 5:51 PM
private
XpsDocument ConvertWordDocToXPSDoc(
string
wordDocName,
string
xpsDocName) {
// Create a WordApplication and add Document to it
Microsoft.Office.Interop.Word.Application
wordApplication =
new
Microsoft.Office.Interop.Word.Application();
wordApplication.Documents.Add(wordDocName);
Document doc = wordApplication.ActiveDocument;
try
{
doc.SaveAs(xpsDocName, WdSaveFormat.wdFormatXPS);
wordApplication.Quit();
XpsDocument xpsDoc =
new
XpsDocument(xpsDocName, FileAccess.ReadWrite);
return
xpsDoc;
}
catch
(Exception exp) {
string
str = exp.Message;
}
return
null
;
}
private
void
LoadMyreminder() {
string
XPSMyReminder = String.Concat(Path.GetDirectoryName(_myReminder),
"\\"
,
Path.GetFileNameWithoutExtension(_myReminder),
".xps"
);
myRemviewer.Document = ConvertWordDocToXPSDoc(
_myReminder,
XPSMyReminder).GetFixedDocumentSequence();
}
private
void
BtnEditMyrem_Click(
object
sender, RoutedEventArgs e) {
Microsoft.Office.Interop.Word.Application ap =
new
Microsoft.Office.Interop.Word.Application {
Visible =
true
};
Document document = ap.Documents.Open(_myReminder);
}
Reply
Answers (
1
)
Want to change rules to be generic and should pass the test
how to autoincrement the u value in asp.net?