DocumentImageSource.FromStream(Stream) Method
Creates an image source object from the specified data stream.
Namespace: DevExpress.XtraRichEdit.API.Native
Assembly: DevExpress.RichEdit.v24.1.Core.dll
NuGet Packages: DevExpress.RichEdit.Core, DevExpress.Win.Navigation
Declaration
Parameters
Name | Type | Description |
---|---|---|
stream | Stream | A Stream containing image data. |
Returns
Type | Description |
---|---|
DocumentImageSource | A DocumentImageSource object representing the image in the document. |
Remarks
The following code sample illustrates how the FromStream
can be used to insert an image at the specified position from the data stream.
using DevExpress.XtraRichEdit;
using DevExpress.XtraRichEdit.API.Native;
using (var wordProcessor = new RichEditDocumentServer()) {
wordProcessor.LoadDocument("Texts\\Pictures.docx");
Document doc = wordProcessor.Document;
// Insert an image from a stream.
pos = doc.Paragraphs[4].Range.Start;
string imageToInsert = "information.png";
Assembly a = Assembly.GetExecutingAssembly();
Stream imageStream = a.GetManifestResourceStream("InlinePictures.Resources." + imageToInsert);
doc.Shapes.InsertPicture(pos, DocumentImageSource.FromStream(imageStream));
}
Related GitHub Examples
The following code snippets (auto-collected from DevExpress Examples) contain references to the FromStream(Stream) method.
Note
The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.