Jump to content

Recommended Posts

Posted

Hi all,

I need to set a word document's left, right indents programatically. Say, when i press Alt+L, then left indent should go to a specific location. And when i press Alt+R, then right indent should go to a specific location. I have searched a lot in the members of Range object. But couldn't find anything related to indents. My assumption is that, there is a property in range object like this- "$Range.LeftIndent = 3.5" and "$Range.RightIndent = 5.5"  I need help. I am struggling.

  Reveal hidden contents

 

Posted (edited)

Um, got a hint. "Range.ParagraphFormat.Tabstops" Let me check it.

Edit. I have got ParagraphFormat.TabIndent() for left indent. But what is for right indent ?

Edit2 - How can i use "InchesToPoints" in AutoIt ?

Edited by kcvinu
  Reveal hidden contents

 

Posted

I'm not sure but I think it's a method of the application or document object. 

My UDFs and Tutorials:

  Reveal hidden contents

 

Posted

@water , Now, left side indent is ok. I need to find out how to set the right side indent . :) 

  Reveal hidden contents

 

Posted (edited)

Atlast i got it. 

$wRange.ParagraphFormat.RightIndent = 230

So simple

Edit. Only drawback of this method is that, it uses point instead of inches. 

Edited by kcvinu
  Reveal hidden contents

 

Posted (edited)

You might want to use the methods of the Word application object or the following functions to translate from/to points:

Func CentimetersToPoints($iValue)
    Return ($iValue * 28.35)
EndFunc   ;==>CentimetersToPoints

Func InchesToPoints($iValue)
    Return ($iValue * 72)
EndFunc   ;==>InchesToPoints

Func LinesToPoints($iValue)
    Return ($iValue * 12)
EndFunc   ;==>LinesToPoints

Func PicasToPoints($iValue)
    Return ($iValue * 12)
EndFunc   ;==>PicasToPoints

Func PointsToCentimeters($iValue)
    Return ($iValue / 28.35)
EndFunc   ;==>CentimetersToPoints

Func PointsToInches($iValue)
    Return ($iValue / 72)
EndFunc   ;==>InchesToPoints

Func PointsToLines($iValue)
    Return ($iValue / 12)
EndFunc   ;==>LinesToPoints

Func PointsToPicas($iValue)
    Return ($iValue / 12)
EndFunc   ;==>PicasToPoints

 

Edited by water

My UDFs and Tutorials:

  Reveal hidden contents

 

Posted

@water , Wow !. Great. I don't know how to say thanks for this. Anyway Thank you. :)

  Reveal hidden contents

 

Posted

Glad to be of service :)

My UDFs and Tutorials:

  Reveal hidden contents

 

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...