By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,158 Members | 1,376 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,158 IT Pros & Developers. It's quick & easy.

Create EMF with rotated text that is editable in office

P: n/a
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
May 10 '06 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Try specifying that the metafile can use both EMF and enhanced EMF (with
GDI+ commands).

--
Bob Powell [MVP]
Visual C#, System.Drawing

Ramuseco Limited .NET consulting
http://www.ramuseco.com

Find great Windows Forms articles in Windows Forms Tips and Tricks
http://www.bobpowell.net/tipstricks.htm

Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/faqmain.htm

All new articles provide code in C# and VB.NET.
Subscribe to the RSS feeds provided and never miss a new article.

"Tilo Pätzold" <tilo.paetzold@R E M O V E l-p-a.com> wrote in message
news:ug**************@TK2MSFTNGP03.phx.gbl...
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

May 10 '06 #2

P: n/a
Good idea. I tried all types.
Both EmfType.EmfOnly and EmfType.EmfPlusDual result in single
charackter blocks when ungrouping.
EmfType.EmfPlusOnly results in an empty graphic when ungrouping.
Unfortunately no type gives a satisfying result.
Our Office version is 2003 SP2.

May 15 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.