in reply to Unicode characters in Win32::Powerpoint
Hope this helps - I've successfully tested this under Windows 7, using Strawberry Perl 5.12.3 and Powerpoint 2010.use strict; use utf8; use warnings; use File::Spec qw(rel2abs); use Win32::OLE qw( in CP_UTF8 ); Win32::OLE->Option( CP => CP_UTF8 ); $Win32::OLE::Warn = 3; # used File::Spec to save the file in my local directory # as Windows 7 is more restrictive about # users' file writing permissions than Windows XP my $filename = File::Spec->rel2abs("./unicode_example.ppt"); print( "Starting Powerpoint Object\n" ); my $power = Win32::OLE->GetActiveObject('Powerpoint.Application') || Win32::OLE->new('Powerpoint.Application', 'Quit'); my $ppt = $power->Presentations->Add(); # 12 = blank layout my $slide = $ppt->Slides->Add(1,12); # 1 = text in horizontal direction, the next two numbers describe the +position # and the last numbers the width and height of the box my $new_textbox = $slide->Shapes->AddTextbox(1,30,30,600,200); my $text_frame = $new_textbox->TextFrame; my $text_range = $text_frame->TextRange; $text_range->{Text} = "Please print \x{03B1},\x{03B2},\x{03B3}"; $ppt->SaveAs($filename);
|
|---|