public string CreateImageUri(string rootUri, DevExpress.Office.Utils.OfficeImage image, string relativeUri)
        {
            string imagesDir = String.Format("{0}\\{1}", this.rootDirecory, rootUri.Trim('/'));

            if (!Directory.Exists(imagesDir))
            {
                Directory.CreateDirectory(imagesDir);
            }
            string imageName = String.Format("{0}\\{1}.png", imagesDir, Guid.NewGuid());

            image.NativeImage.Save(imageName, ImageFormat.Png);
            return(GetRelativePath(imageName));
        }
Esempio n. 2
0
 static void SaveImageToFile(Document document)
 {
     #region #SaveImageToFile
     document.LoadDocument("Documents//MovieRentals.docx", DevExpress.XtraRichEdit.DocumentFormat.OpenXml);
     DocumentRange myRange = document.CreateRange(0, 100);
     ReadOnlyDocumentImageCollection images = document.Images.Get(myRange);
     if (images.Count > 0)
     {
         DevExpress.Office.Utils.OfficeImage myImage = images[0].Image;
         System.Drawing.Image image = myImage.NativeImage;
         string imageName           = String.Format("Image_at_pos_{0}.png", images[0].Range.Start.ToInt());
         image.Save(imageName);
         System.Diagnostics.Process.Start("explorer.exe", "/select," + imageName);
     }
     #endregion #SaveImageToFile
 }
Esempio n. 3
0
 static void SaveImageFromRange(Document document)
 {
     #region #SaveImageFromRange
     document.LoadDocument("Documents//Grimm.docx", DocumentFormat.OpenXml);
     DocumentRange docRange = document.Paragraphs[2].Range;
     ReadOnlyDocumentImageCollection docImageColl = document.Images.Get(docRange);
     if (docImageColl.Count > 0)
     {
         DevExpress.Office.Utils.OfficeImage myImage = docImageColl[0].Image;
         System.Drawing.Image image = myImage.NativeImage;
         string imageName           = String.Format("Image_at_pos_{0}.png", docRange.Start.ToInt());
         image.Save(imageName);
         System.Diagnostics.Process.Start("explorer.exe", "/select," + imageName);
     }
     #endregion #SaveImageFromRange
 }