CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Mar 2005
    Location
    Vienna, Austria
    Posts
    4,538

    [RESOLVED] Getting Strange Graphic values from Word doc

    Hi !
    I'm reading word doc ant then drawing it myself using C# in my own document Viewer.
    ( the point is that there are automtically added data to the documnts and the result is shown to the user. ) OK, This works fine but I have some strange margin output from the word doc. Word uses POINTS Heee

    To be concret. I'm using 'cm' as I'm here in Europe and 1 Inch is 2.54 cm
    As I could see using a macro internally when I change the size of the margin in the word doc to for example 2.54 cm ( 1 Inch) then the internal VBA code in Word is (Checked what the macro writes down when changing the margins )
    Code:
        With ActiveSheet.PageSetup
            .LeftMargin = Application.CentimeterToPoints(2.54)
            .RightMargin = Application.CentimeterToPoints(2.54)
            ....
        End With
    So I get 72 Points. To get sure to have the correct measurement I'm retransforming it using
    Code:
    _docMarginTop = wordApp.PointsToCentimeters(doc.PageSetup.TopMargin);
    In the moment I actually have only word 2003 on my macine and only such files.
    What I'm wondering is: Have they done this margins measured in 'points' all the time so also in older versions like word 97, word 2000, will the output be in points ?? I'm asking because word 97, word2000 and word 2003 are most of the docs that will be used in my program and it needs to print the correct margin. And will that be the same in word 2007 too ?
    Last edited by JonnyPoet; March 19th, 2009 at 08:31 AM. Reason: Expressed in a way hopefully better to understand
    Jonny Poet

    To be Alive is depending on the willingsness to help others and also to permit others to help you. So lets be alive. !
    Using Code Tags makes the difference: Code is easier to read, so its easier to help. Do it like this: [CODE] Put Your Code here [/code]
    If anyone felt he has got help, show it in rating the post.
    Also dont forget to set a post which is fully answered to 'resolved'. For more details look to FAQ's about Forum Usage. BTW I'm using Framework 3.5 and you ?
    My latest articles :
    Creating a Dockable Panel-Controlmanager Using C#, Part 1 | Part 2 | Part 3 | Part 4 | Part 5 | Part 6 | Part 7

  2. #2
    Join Date
    Mar 2005
    Location
    Vienna, Austria
    Posts
    4,538

    Re: [RESOLVED] Getting Strange Graphic values from Word doc

    I resolved it myself by simple testing different docs, of different years it works.
    Jonny Poet

    To be Alive is depending on the willingsness to help others and also to permit others to help you. So lets be alive. !
    Using Code Tags makes the difference: Code is easier to read, so its easier to help. Do it like this: [CODE] Put Your Code here [/code]
    If anyone felt he has got help, show it in rating the post.
    Also dont forget to set a post which is fully answered to 'resolved'. For more details look to FAQ's about Forum Usage. BTW I'm using Framework 3.5 and you ?
    My latest articles :
    Creating a Dockable Panel-Controlmanager Using C#, Part 1 | Part 2 | Part 3 | Part 4 | Part 5 | Part 6 | Part 7

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured