473,465 Members | 1,908 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Create EMF with rotated text that is editable in office

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
2 5767
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: rzed | last post by:
I'm using PIL to generate some images which may be rotated at the user's option. When they are rotated, the original image is cropped in the new image (which is fine), and the corners are black...
17
by: black tractor | last post by:
HI there.. l was just wondering, if l place a "table" in the "editable region" of my template, will the text, graphics placed inside the this "table" MOVE BY ITSELF?? l mean, recently l had a...
1
by: amirkargerweb | last post by:
I want to do this: <textarea> perl <font color="FF0000"> $thing_to_get=17; </font> More Perl code using $thing_to_get </textarea>
6
by: charsh | last post by:
Hi, I using the code below to draw a text in a pictureBox1. //Start--------------------------------------------------------------- private void button1_Click(object sender, System.EventArgs e)...
2
by: Gary | last post by:
Hello All, I have an editable data grid in my web form, this grid allows the user to add new records, edit existing records and also delete them. When a user adds a record the grid goes in to...
1
by: Eric Apperley | last post by:
How do I draw rotated text in a Tkinter widget using the draw.text method? Alternatively, if I draw text as normal, how can I then subsequently rotate it about its start point?
0
by: Khadim | last post by:
Hi, I am facing a problem in my application. I have an image on which there are many numbers present. I can find the pixel position of the center of those numbers. Now I have the names of those...
4
by: etuncer | last post by:
Hello All, I have Access 2003, and am trying to build a database for my small company. I want to be able to create a word document based on the data entered through a form. the real question is...
7
by: halo combat22 | last post by:
I need help on a project i was assigned. I need a way to recognize these numbers. Any help is appreciated.
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.