P
Pferril
HI all, Im developing an application to export PowerPoint 2003 Content to
Word 2003 (Dont ask why), and it works pretty well, but im facing a problem
here, for some reason (Sometimes) i get a font size negative. Here´s some
code
objSlide =
(Microsoft.Office.Interop.PowerPoint._Slide)objPres.Slides._Index(i);
CantShapes = objSlide.Shapes.Count;
for (int j = 1; j <= CantShapes; j++)
{
if (objSlide.Shapes[j].HasTextFrame ==
MsoTriState.msoTrue)
{
objTextRng =
objSlide.Shapes[j].TextFrame.TextRange;
ShapeText = objTextRng.Text + "\r\n";
if (ChkBxEstilo.Checked == true)
{
Microsoft.Office.Interop.PowerPoint.Font
fuente = objSlide.Shapes[j].TextFrame.TextRange.Font;
WordApp.Selection.Font.Name = fuente.Name;
WordApp.Selection.Font.Size = fuente.Size;
WordApp.Selection.Font.Bold =
(int)fuente.Bold;
WordApp.Selection.Font.Italic =
(int)fuente.Italic;
WordApp.Selection.Font.Color =
(Microsoft.Office.Interop.Word.WdColor)fuente.Color.RGB;
}
WordApp.Selection.TypeText(ShapeText);
}
}
As you see, i put the text shape text in the ShapeText and pass it to
WordApp.Selection. The problem comes when i want to format the text. Im
having problemsd with the Font.Size part, sometimes (with particular files) i
get a -2.0 font size. The weird part its that if i open the PPt file and
check that shape font, it is correct (36--28--20 all non negative) and only
happends with some files, not with all of them.
Does anyone has any ideas on this matter?, im kind of stuck here.
Tnks a lot for your time.
Word 2003 (Dont ask why), and it works pretty well, but im facing a problem
here, for some reason (Sometimes) i get a font size negative. Here´s some
code
objSlide =
(Microsoft.Office.Interop.PowerPoint._Slide)objPres.Slides._Index(i);
CantShapes = objSlide.Shapes.Count;
for (int j = 1; j <= CantShapes; j++)
{
if (objSlide.Shapes[j].HasTextFrame ==
MsoTriState.msoTrue)
{
objTextRng =
objSlide.Shapes[j].TextFrame.TextRange;
ShapeText = objTextRng.Text + "\r\n";
if (ChkBxEstilo.Checked == true)
{
Microsoft.Office.Interop.PowerPoint.Font
fuente = objSlide.Shapes[j].TextFrame.TextRange.Font;
WordApp.Selection.Font.Name = fuente.Name;
WordApp.Selection.Font.Size = fuente.Size;
WordApp.Selection.Font.Bold =
(int)fuente.Bold;
WordApp.Selection.Font.Italic =
(int)fuente.Italic;
WordApp.Selection.Font.Color =
(Microsoft.Office.Interop.Word.WdColor)fuente.Color.RGB;
}
WordApp.Selection.TypeText(ShapeText);
}
}
As you see, i put the text shape text in the ShapeText and pass it to
WordApp.Selection. The problem comes when i want to format the text. Im
having problemsd with the Font.Size part, sometimes (with particular files) i
get a -2.0 font size. The weird part its that if i open the PPt file and
check that shape font, it is correct (36--28--20 all non negative) and only
happends with some files, not with all of them.
Does anyone has any ideas on this matter?, im kind of stuck here.
Tnks a lot for your time.