[Solved] Switch to View HTML Source

Creating a macro - Writing a Script - Using the API (OpenOffice Basic, Python, BeanShell, JavaScript)
Post Reply
edwardrussia
Posts: 16
Joined: Thu Oct 14, 2010 11:08 pm

[Solved] Switch to View HTML Source

Post by edwardrussia »

I found this code for switching to Web Layout view: http://user.services.openoffice.org/en/ ... =7&t=36948 (see below)

But I really want to switch to View HTML Source in OOo Writer. Could someone tell me how to change the code? My searches have been unsuccessful.

Thanks for any help you can give me!

Code: Select all

rem get access to the document
document   = ThisComponent.CurrentController.Frame
dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")

rem ----------------------------------------------------------------------
dim args1(0) as new com.sun.star.beans.PropertyValue
args1(0).Name = "BrowseView"
args1(0).Value = true

dispatcher.executeDispatch(document, ".uno:BrowseView", "", 0, args1())
Last edited by edwardrussia on Tue Oct 18, 2011 9:42 pm, edited 1 time in total.
OOo 3.4.1; WindowsXP
User avatar
MrProgrammer
Moderator
Posts: 4907
Joined: Fri Jun 04, 2010 7:57 pm
Location: Wisconsin, USA

Re: Switch to View HTML Source

Post by MrProgrammer »

See Framework Commands. Based on that, I'd suggest that you try:

Code: Select all

dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")
dim argsSV(0) as new com.sun.star.beans.PropertyValue
argsSV(0).Name = "SourceView" : argsSV(0).Value = true
dispatcher.executeDispatch(ThisComponent.CurrentController.Frame,".uno:SourceView","",0,argsSV()) 
If you want to start writing/modifying macros, you should read http://www.pitonyak.org/AndrewMacro.odt and then become familiar with the API and the other resources at the Macros and UNI API forum.
Last edited by MrProgrammer on Mon Nov 12, 2012 4:18 pm, edited 1 time in total.
Mr. Programmer
AOO 4.1.7 Build 9800, MacOS 13.6.3, iMac Intel.   The locale for any menus or Calc formulas in my posts is English (USA).
edwardrussia
Posts: 16
Joined: Thu Oct 14, 2010 11:08 pm

Re: Switch to View HTML Source

Post by edwardrussia »

That's great - it works! Thanks for the link - I would have never found it myself!
OOo 3.4.1; WindowsXP
Post Reply