Quantcast
Channel: Word for Developers forum
Viewing all articles
Browse latest Browse all 4350

Save images on word first in first out basis C#

$
0
0
   

Hi below code take snapshot and save in word and append on existing word.. when I execute this code its saving the image on first in last out basis means first image pushed down when I took new screenshot is there any possibilities to make it has first in first out means when I took image its store on top of the document and remaining needs to store in down...

 

Bitmap bmpScreenshot = new Bitmap(Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height);
            Graphics gfxScreenshot = Graphics.FromImage(bmpScreenshot as Image);
            gfxScreenshot.CopyFromScreen(0, 0, 0, 0, bmpScreenshot.Size);
            Clipboard.SetImage(bmpScreenshot);  

            Microsoft.Office.Interop.Word._Application oWord = new Microsoft.Office.Interop.Word.Application();
            Microsoft.Office.Interop.Word._Document oDoc = oWord.Documents.Open(@"F:\sam\test.docx", ReadOnly: false, Visible: true);
            oWord.Visible = true;        
            object start = 0;
            object end = 0;
            Microsoft.Office.Interop.Word.Range rng = oDoc.Range(ref start, ref end);        
            rng.Paste();

            rng.InsertParagraph();
            object oEnd = Microsoft.Office.Interop.Word.WdCollapseDirection.wdCollapseEnd;
            rng.Collapse(ref oEnd);
           
            oDoc.Save();
            Clipboard.Clear();
            oDoc.Close();
            oWord.Quit();


Viewing all articles
Browse latest Browse all 4350

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>