Hello, I am creating an elipse using the shape object:
Aspose.Words.Drawing.Shape elipse = new Aspose.Words.Drawing.Shape(builder.Document, Aspose.Words.Drawing.ShapeType.Ellipse);
elipse.FillColor = Color.Red;
elipse.Width = 10;
elipse.Height = 10;
builder.InsertNode(elipse);
When i save the document as ODT, HTML or MHTML the shapes are lost. (PDF and all Word formats works fine).
I guess html and odt does not support vector graphics. Maybe if the shapes were converted to Emf images internally it would work.
My current solution is to render an EMF Image using the .NET graphics object and inserting it to the document:
using (MemoryStream stream = new MemoryStream())
using (System.Drawing.Bitmap bmp = new System.Drawing.Bitmap(1, 1, System.Drawing.Imaging.PixelFormat.Format24bppRgb))
using (System.Drawing.Graphics gTmp = System.Drawing.Graphics.FromImage(bmp))
{
System.IntPtr hdc = gTmp.GetHdc();
using (System.Drawing.Imaging.Metafile metafile = new System.Drawing.Imaging.Metafile(stream, hdc, new System.Drawing.Rectangle(0, 0, 10, 10), System.Drawing.Imaging.MetafileFrameUnit.Pixel, System.Drawing.Imaging.EmfType.EmfPlusDual))
using (Graphics g = Graphics.FromImage(metafile))
{
g.FillEllipse(Brushes.Red, 0, 0, 10, 10);
gTmp.ReleaseHdc(hdc);
}
builder.InsertImage(stream);
}
Using this solution, if I save as PDF will the image be treated as vector graphics or converted to a Bitmap?
I am using Aspose 6.0