Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8953965
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T14:12:33+00:00 2026-06-15T14:12:33+00:00

Background : I am trying to generate a word document using c# and Interop.

  • 0

Background: I am trying to generate a word document using c# and Interop. I am successful in inserting tables, headers, footers, diagrams..most of the things are working fine. As a next step, I am looking to convert this into pdf.

Process adapted: Since I am using word 2011 and word 2007 (after installing saveaspdf plugin), I am saving the document in pdf using “save as” and then file type as pdf.

Problems Raised: I have successfully embedded a pdf into my document using following code.

        Object oIconLabel = new FileInfo(file_path).Name;
        Object oFileDesignInfo = file_path;
        Object oClassType = "AcroExch.Document.7";
        Object oTrue = true;
        Object oFalse = false;
        Object oMissing = System.Reflection.Missing.Value;
        Object index = 0;
        Range r = d.Bookmarks.get_Item(ref eod).Range;

        r.InlineShapes.AddOLEObject(
            ref oClassType, ref oFileDesignInfo, ref oFalse, ref oTrue, ref oMissing,
            ref index, ref oIconLabel, ref oMissing);

Here d is the Document object. Now When I tried to save this word document as pdf, using

 d.SaveAs(ref filename, ref filetype, ref oMissing, ref oMissing, ref oMissing, 
ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, 
ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing);

pdf is getting generated. But the document which i embedded is not getting embedded into the generated pdf. rather only a icon is getting displayed.

How can I embed the document into pdf.? How do we usually handle this kind of situations. Kindly let me know if question is not clear.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T14:12:34+00:00Added an answer on June 15, 2026 at 2:12 pm

    it is the wrong api thot I chose. it should not be SaveAs. it is ExportAsFixedFormat.

    documentation is present here

    sample usage can be

    d.ExportAsFixedFormat(filename.ToString(), WdExportFormat.wdExportFormatPDF,false,WdExportOptimizeFor.wdExportOptimizeForOnScreen,
                        WdExportRange.wdExportAllDocument,1,1,WdExportItem.wdExportDocumentContent,true,true,
                        WdExportCreateBookmarks.wdExportCreateHeadingBookmarks,true,true,false,ref oMissing);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to generate xml file as a background task using resque gem
We are trying to generate an excel sheet using a template. Normally we would
I am trying to procedurally generate point stars to create a starfield background for
I am trying to generate images using ImageMagick, please check the code below: <?
I am trying to create a PDF document in the background via Resque background
I am trying to generate a JXTable with a background image ( a text
I spent some time trying to generate certain tab icons using Android Asset Studio
I am trying to generate a XLS sheet with multiple sheets, styles, background colors
This is what I'm trying to generate: <div class=marker style=background:transparent url('/myApp/faces/javax.faces.resource/1.png?ln=images/map') no-repeat center top;></div>
I'm trying to randomize background pic and generate some text on it. So here

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.