在MFC中操作WORD,如何使已经首行悬进的段落,去掉该段落的首行悬进.VBA代码如下:
    With Selection.ParagraphFormat
        .LeftIndent = MillimetersToPoints(0)
        .RightIndent = MillimetersToPoints(0)
        .SpaceBefore = 0
        .SpaceBeforeAuto = False
        .SpaceAfter = 2.5
        .SpaceAfterAuto = False
        .LineSpacingRule = wdLineSpaceSingle
        .Alignment = wdAlignParagraphLeft
        .WidowControl = False
        .KeepWithNext = False
        .KeepTogether = False
        .PageBreakBefore = False
        .NoLineNumber = False
        .Hyphenation = True
        .FirstLineIndent = MillimetersToPoints(0)
        .OutlineLevel = wdOutlineLevelBodyText
        .CharacterUnitLeftIndent = 0
        .CharacterUnitRightIndent = 0
        .CharacterUnitFirstLineIndent = 0
        .LineUnitBefore = 0
        .LineUnitAfter = 0.5
        .AutoAdjustRightIndent = False
        .DisableLineHeightGrid = False
        .FarEastLineBreakControl = True
        .WordWrap = True
        .HangingPunctuation = True
        .HalfWidthPunctuationOnTopOfLine = False
        .AddSpaceBetweenFarEastAndAlpha = False
        .AddSpaceBetweenFarEastAndDigit = False
        .BaseLineAlignment = wdBaselineAlignAuto
    End With
如何转换为VC代码呢?

解决方案 »

  1.   

    pf = Selection->GetParagraphFormat();
    pf->PutProperty("LeftIndent", COleVariant(...));
    pf->PutProperty("RightIndent", COleVariant(...));
    ......
      

  2.   

    VBA代码如下
        Selection.ParagraphFormat.FirstLineIndent = 0
        Selection.ParagraphFormat.CharacterUnitFirstLineIndent = 0
        Selection.ParagraphFormat.FirstLineIndent = 0
      

  3.   

    多谢jameshooo 指点.结贴代码如下
    _ParagraphFormat pf1 =  mysel.GetParagraphFormat();
    pf1.SetFirstLineIndent(0);
    pf1.SetCharacterUnitFirstLineIndent(0);
    pf1.SetFirstLineIndent(0);