Click here to Skip to main content
15,910,211 members
Home / Discussions / C#
   

C#

 
GeneralRe: Pharmacy Program Pin
Luc Pattyn10-Dec-09 6:11
sitebuilderLuc Pattyn10-Dec-09 6:11 
GeneralRe: Pharmacy Program Pin
OriginalGriff10-Dec-09 8:28
mveOriginalGriff10-Dec-09 8:28 
GeneralRe: Pharmacy Program Pin
ragnaroknrol10-Dec-09 5:53
ragnaroknrol10-Dec-09 5:53 
GeneralRe: Pharmacy Program Pin
Dave Sexton10-Dec-09 6:07
Dave Sexton10-Dec-09 6:07 
GeneralRe: Pharmacy Program Pin
Luc Pattyn10-Dec-09 6:12
sitebuilderLuc Pattyn10-Dec-09 6:12 
AnswerRe: Pharmacy Program Pin
MumbleB10-Dec-09 7:33
MumbleB10-Dec-09 7:33 
AnswerRe: Pharmacy Program Pin
Dave Kreskowiak10-Dec-09 9:45
mveDave Kreskowiak10-Dec-09 9:45 
QuestionOffice 2007 Word automation - setting default conversion for InsertFile Pin
Sibble10-Dec-09 4:21
Sibble10-Dec-09 4:21 
Hi
I need to insert some HTML-styled text into a Word 2007 document. As far as I know you cannot directly insert HTML into Word, because it needs to be converted first. So I save the HTML as a temporary file and use InsertRange to insert it into my document.

Here is my code:
string TempFileSaveDir = "c:\\word";

private void InsertHTML(Document pDoc, string pHTML)
{
    Guid _guid = Guid.NewGuid();

    string _fileName = TempFileSaveDir + "\\" + _guid.ToString() + ".html";
    TextWriter tw = new StreamWriter(_fileName, false, Encoding.UTF8);            
    tw.Write(pHTML);
    tw.Close();

    object start = 0;
    object end = 0;
    object ConfirmConversions = false;
    object Link = false;
    object Attachment = false;
    object missing = System.Type.Missing;

    Word.Range _range1 = pDoc.Range(ref start, ref end);
    _range1.InsertFile(_fileName, ref missing, ref ConfirmConversions, ref Link, ref Attachment);

    File.Delete(_fileName);
}


Now my problem is, that Word sees it as regular text rather than HTML, so if I have <b>Some Text</b> in my HTML it'll show the B tags instead of bolded text.
I noticed that when I set ConfirmConversions to true I get a popup, where I can select the HTML conversion. Is there a way to have the converter automaticly use this conversion without prompting the user every time?

Regards
AnswerRe: Office 2007 Word automation - setting default conversion for InsertFile Pin
The Man from U.N.C.L.E.14-Dec-09 3:17
The Man from U.N.C.L.E.14-Dec-09 3:17 
Question[Message Deleted] Pin
Sr...Frank10-Dec-09 4:00
Sr...Frank10-Dec-09 4:00 
AnswerRe: System Dialog! Pin
Eddy Vluggen10-Dec-09 4:08
professionalEddy Vluggen10-Dec-09 4:08 
AnswerRe: System Dialog! My vote of 1. [modified] Pin
Keith Barrow10-Dec-09 4:09
professionalKeith Barrow10-Dec-09 4:09 
AnswerRe: System Dialog! Pin
Dave Kreskowiak10-Dec-09 4:21
mveDave Kreskowiak10-Dec-09 4:21 
QuestionMessage Removed Pin
10-Dec-09 3:44
Omoniyi Ogunderu10-Dec-09 3:44 
AnswerRe: PROBLEM PORTING APP ON VISTA :INTERFACE IS DULL ON VISTA Pin
Dave Kreskowiak10-Dec-09 4:17
mveDave Kreskowiak10-Dec-09 4:17 
GeneralRe: PROBLEM PORTING APP ON VISTA :INTERFACE IS DULL ON VISTA Pin
Omoniyi Ogunderu28-Dec-09 6:34
Omoniyi Ogunderu28-Dec-09 6:34 
GeneralRe: PROBLEM PORTING APP ON VISTA :INTERFACE IS DULL ON VISTA Pin
Dave Kreskowiak28-Dec-09 15:15
mveDave Kreskowiak28-Dec-09 15:15 
AnswerRe: PROBLEM PORTING APP ON VISTA :INTERFACE IS DULL ON VISTA Pin
Keith Barrow10-Dec-09 4:22
professionalKeith Barrow10-Dec-09 4:22 
Questionyour idea plz: customer account number Pin
Jassim Rahma10-Dec-09 3:19
Jassim Rahma10-Dec-09 3:19 
AnswerRe: your idea plz: customer account number Pin
Keith Barrow10-Dec-09 3:37
professionalKeith Barrow10-Dec-09 3:37 
GeneralRe: your idea plz: customer account number Pin
Jassim Rahma10-Dec-09 3:48
Jassim Rahma10-Dec-09 3:48 
GeneralRe: your idea plz: customer account number Pin
Andrew Rissing10-Dec-09 3:56
Andrew Rissing10-Dec-09 3:56 
GeneralRe: your idea plz: customer account number Pin
Keith Barrow10-Dec-09 3:59
professionalKeith Barrow10-Dec-09 3:59 
GeneralRe: your idea plz: customer account number Pin
Eddy Vluggen10-Dec-09 4:43
professionalEddy Vluggen10-Dec-09 4:43 
AnswerRe: your idea plz: customer account number Pin
PIEBALDconsult10-Dec-09 5:36
mvePIEBALDconsult10-Dec-09 5:36 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.