PowerPoint 2007 Compatibility Indentation Marker Overlaps via .NET interop issue

I have a very complicated error and I don’t see a fix. The subject makes me crazy for a long time. Consider the following scenario:

1) There is a PowerPoint 2003 presentation. It contains a single slide and a single shape, but the form contains a text frame containing a bulleted list with a random text presentation structure.

2) There is a requirement to get marker indents for each bulleted paragraph using PowerPoint 2007. I can satisfy the requirement that opens the presentation in compatibility mode and using the following VBA script:

With ActivePresentation
  Dim sl As Slide: Set sl = .Slides(1)
  Dim sh As Shape: Set sh = sl.Shapes(1)
  Dim i As Integer
  For i = 1 To sh.TextFrame.TextRange.Paragraphs.Count
    Dim para As TextRange: Set para = sh.TextFrame.TextRange.Paragraphs(i, 1)
    Debug.Print para.Text; para.indentLevel, sh.TextFrame.Ruler.Levels(para.indentLevel).FirstMargin
  Next i
End With

which produces the following output:

A 1 0 
B 1 0 
C 2 24 
D 3 60 
E 5 132 

, : , . , #. COM- Microsoft.Office.Interop.PowerPoint 2.9.0.0 ( MSPPT.OLB, MS Office 12):

// presentation = ...("presentation.ppt")... // a PowerPoint 2003 presentation
Slide slide = presentation.Slides[1];
Shape shape = slide.Shapes[1];
for (int i = 1; i<=shape.TextFrame.TextRange.Paragraphs(-1, -1).Count; i++) {
    TextRange paragraph = shape.TextFrame.TextRange.Paragraphs(i, 1);
    Console.WriteLine("{0} {1} {2}", paragraph.Text, paragraph.IndentLevel, shape.TextFrame.Ruler.Levels[paragraph.IndentLevel].FirstMargin);
}

, ... ? . -, paragraph.Text , '\r' ( paragraph.Text[0] O_o). , . ... , -, , , , . ... ...:) ? . , .:( , - ... - , Microsoft?

.

+3

Source: https://habr.com/ru/post/1730857/


All Articles