T
Tilo Pätzold
Hi Everybody (especially Microsoft),
we build EMF files with rotated text for export to office (powerpoint,
word). It is planned that the text can be edited in the office document.
Without the rotate transformation the text stays as a block and can be
edited in the office document after ungrouping. But a rotated text leads to
single charackters when ungrouping.
The following sample code creates an emf file. The file can be dragged to
powerpoint to see the problem.
Bitmap bmp = new Bitmap(100, 100, PixelFormat.Format32bppArgb);
Graphics g = Graphics.FromImage(bmp);
IntPtr hdc = g.GetHdc();
Metafile mf = new Metafile(@"test.emf", hdc);
g.ReleaseHdc(hdc);
g.Dispose();
g = Graphics.FromImage(mf);
g.RotateTransform(30.0f); // Leads to single charackters in the Emf file
String s = "1.2345";
g.DrawString(s, this.Font, Brushes.Red, 0, 0);
g.Dispose();
Can anyone tell me how I can draw rotated text without loosing the editing
capability?
There must be a way. Because when I make a rotated text area in power point
and save this to an emf picture it can be imported without loosing editing
capability. I already enumerated the metafile to find out the record types.
But that does not tell me which gdi methods I have to use.
Thank you.
Cheers,
Tilo
we build EMF files with rotated text for export to office (powerpoint,
word). It is planned that the text can be edited in the office document.
Without the rotate transformation the text stays as a block and can be
edited in the office document after ungrouping. But a rotated text leads to
single charackters when ungrouping.
The following sample code creates an emf file. The file can be dragged to
powerpoint to see the problem.
Bitmap bmp = new Bitmap(100, 100, PixelFormat.Format32bppArgb);
Graphics g = Graphics.FromImage(bmp);
IntPtr hdc = g.GetHdc();
Metafile mf = new Metafile(@"test.emf", hdc);
g.ReleaseHdc(hdc);
g.Dispose();
g = Graphics.FromImage(mf);
g.RotateTransform(30.0f); // Leads to single charackters in the Emf file
String s = "1.2345";
g.DrawString(s, this.Font, Brushes.Red, 0, 0);
g.Dispose();
Can anyone tell me how I can draw rotated text without loosing the editing
capability?
There must be a way. Because when I make a rotated text area in power point
and save this to an emf picture it can be imported without loosing editing
capability. I already enumerated the metafile to find out the record types.
But that does not tell me which gdi methods I have to use.
Thank you.
Cheers,
Tilo