Why Shape.TextFrame.Ruler.Levels[i] can't set the bullet indentation?

Dear experts,

I want to set the indentation for each bullet level. And I written follow to do this job.

 

i = 1;
foreach
(PowerPoint.RulerLevel rLevel in
myShape.TextFrame.Ruler.Levels){
rLevel.FirstMargin = (i - 1) * 28;
rLevel.LeftMargin = i * 28;
i++;
}

 

It works for PPT 2003, but it does not work when I use it for PPT 2007. It happens the same no matter I use Macro or VSTO.

Moreover, I watched the Ruler.Level[1].FirstMargin to Ruler.Level[5].FirstMargin in debug mode. I found that they all changed to the same value after the loop. Are they pointed to the same object in PPT 2007?

Does anyone know why it happens any how to solve it?

Thank you very much.

Answer
Answer

Dear experts,

I want to set the indentation for each bullet level. And I written follow to do this job.

 i = 1;
foreach
(PowerPoint.RulerLevel rLevel in
myShape.TextFrame.Ruler.Levels){
rLevel.FirstMargin = (i - 1) * 28;
rLevel.LeftMargin = i * 28;
i++;
}

 

It works for PPT 2003, but it does not work when I use it for PPT 2007. It happens the same no matter I use Macro or VSTO.

Moreover, I watched the Ruler.Level[1].FirstMargin to Ruler.Level[5].FirstMargin in debug mode. I found that they all changed to the same value after the loop. Are they pointed to the same object in PPT 2007?

Does anyone know why it happens any how to solve it?

Thank you very much.


In 07 Ruler object is tied to each level and not the entire shape

With ActiveWindow.Selection.ShapeRange.TextFrame
   .Ruler.Levels(1).FirstMargin = 20
   .Ruler.Levels(2).FirstMargin = 40
   .Ruler.Levels(3).FirstMargin = 60
End With

you can define up to 9 levels


Best regards, Harvey

Was this reply helpful?

Sorry this didn't help.

Great! Thanks for your feedback.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this reply?

Thanks for your feedback.

 
 

Question Info


Last updated September 30, 2021 Views 659 Applies to: