SharePoint Development from a Documentation Perspective

Andrew May

August, 2004

  • Andrew May's WebLog

    OneNote: Positioning Imported Content on Right-To-Left Pages

    • 0 Comments

    Here’s something I found in a code comment in the OneNoteImporter managed assembly source code. It applies to both the OneNoteImporter and the SimpleImporter API itself, and I haven’t seen it documented anywhere else, so I thought I’d pass it on here.

    It concerns positioning objects on OneNote pages that read right-to-left. If you’ve used either the OneNoteImporter and the SimpleImporter API itself, you know you can use the RTL attribute of the <Page> element to set whether you want the page to read right-to-left or vice versa. You can then set the x and y attributes of an object’s <Position> element to determine where you want the object placed on the page. (If you’re using the OneNoteImporter assembly, then set the RTL property of the Page object, and the X and Y properties of the Position object, respectively.)

    OneNote places the objects it imports onto the page based on absolute coordinates, expressed in points. Turns out that the coordinates differ, based on whether the page reads left-to-right or right-to-left.

    Here’s how it works:

    If you set the page to read left-to-right, then the origin (that is, the place there both x and y equal 0) is the upper left hand corner of the OneNote page. X coordinates advance in positive numbering from the left to the right; y coordinates advance in positive numbering horizontally down the page. Pretty straightforward.

    Things get a little more complicated when you set the page to read right-to-left. In this case, the origin (0,0) is the upper right hand corner. But the x and y coordinates still advance in positive numbering in the same directions: x to the left, y horizontally down the page. So for any objects on a right-to-left OneNote page, the x coordinate will actually be a negative number. Indeed, the x coordinates are increasingly negative as you to the left across the page.

    Also remember that the x coordinate refers to the upper left corner of the object, regardless of the direction in which the OneNote page reads.

    So let’s look at an example. The figure below represents a OneNote page, set to read right-to-left. For the sake of argument, assume the page is 600 pixels wide by 750 pixels long (I have no idea what the default size of a OneNote page is.) In this case, the upper left corner coordinates are (-600, 0); the lower left corner coordinates are (-600, 750). The (x, y) coordinates of the object A refer to the position of the upper left corner, and so would be (-400, 100), and not (-250, 100), which is the object’s upper right corner.

    Make sense?

     One last thing: you should also consider page margins when positioning an object on the page. While (0,0) is the absolute origin of the page, depending on user’s preference, their upper left hand corner margin should be at (½”,½”), or (36,36) in points. Which is (-36,36) if the page reads right-to-left.

  • Andrew May's WebLog

    OneNote import Managed Assembly: Customizing How OneNote Launches

    • 0 Comments

    Here’s still more functionality packed into the OneNoteImporter assembly:

    You can also modify how OneNote starts by using the following methods of the Application object. These methods ‘wrap’ command line switches that customize how the OneNote application starts.

    The table below lists the Application object methods, and the command line switch each invokes. If a method is overloaded, the number of overloads is noted next to the method name. In most cases, the method is overloaded to account for the fact that the command line switch takes a series of optional string arguments.

    All the method parameters take strings, except the openReadonly parameter of the Open method, which takes a Boolean value.

    Application method

    Parameters

    Command line switch

    JoinSharedSession (2)

    (sessionAddress)

    (sessionAddress, password, sectionPath)

    /joinsharing

    Open (2)

    (sectionPath)

    (sectionPath, openReadonly)

    /openro

    PauseRecording

    ()

    /pauserecording

    Print

    (sectionPath)

    /print

    StartAudioNote

    ()

    /audionote

    StartSharedSession (3)

    ()

    (sectionPath)

    (sectionPath, password)

    /startsharing

    StartSideNote

    ()

    /sidenote

    StartVideoNote (4)

    ()

    (recordingProfilepath)

    (videoDevice, audioDevice)

    (videoDevice, audioDevice, recordingProfilepath)

    /videonote

    StopRecording

    ()

    /stoprecording

     

    Be aware that these Application methods have been implemented as asynchronous command line calls. Because of this, your code continues to run after it calls Application method is called, independent of whether or not the OneNote application has yet launched.

    In addition, you can use the Activate method to bring the OneNote application to the foreground.

    For more information on the command line switches, see Customizing OneNote 2003 SP 1 Using New Command Line Switches.

    Is there anything these guys didn’t think of?

Page 1 of 1 (2 items)