Catch up on stories from the past week (and beyond) at the Slashdot story archive

 



Forgot your password?
typodupeerror
×
Programming Technology

Hacking OpenOffice 140

prostoalex writes "Peter Sefton appreciates OpenOffice Writer's open and documented XML format and hence tries to customize and configure OO Writer to his own liking. In the article on XML.com he plays with OpenOffice XML, introduces an XSTL style sheet to a Writer document, creates a keyboard shortcut for applying his own style, and creates a macro."
This discussion has been archived. No new comments can be posted.

Hacking OpenOffice

Comments Filter:
  • Not a hack (Score:4, Informative)

    by enoraM ( 749327 ) * on Friday January 28, 2005 @11:12AM (#11503448)
    That's a lot you can do with xsltproc and unzip - but xsltproc is way to neat to call it a hack.
    Most day-to-day manipulations of Open-Office-Documents can easiely be done with perl:
    At the bottom of the article (german) is a listing (Perl)
    http://www.linux-magazin.de/Artikel/ausgabe/2004/1 0/perl/perl.html [linux-magazin.de]
    069 my $oo_output = File::Temp->new(
    070 TEMPLATE => 'ooXXXXX',
    071 DIR => '/tmp',
    072 SUFFIX => '.sxw',
    073 UNLINK => 1,
    074 );
    075
    076 $doc->save($oo_output->filename);
    • Unzipping and using Perl for direct manipulation of the OpenOffice XML files is much faster than heavier solutions, the heaviest of which is the Open Office API.
  • by Anonymous Coward
    I fart on this weak, girly article. Real men use AbiWord. Or emacs.
  • by teiresias ( 101481 ) on Friday January 28, 2005 @11:14AM (#11503474)
    Clippy: I see that you're making a XSTL style sheet to a Writer document. You can't do that with Word. Would you like to:
    -> Learn about XSTL?
    -> Learn about OpenOffice Writer (boo hiss)?
    -> Learn about macros?
    -> What is style by Trading Spaces?
    • by coldmist ( 154493 ) on Friday January 28, 2005 @11:48AM (#11503803) Homepage
      Dave. Create an XSTL style sheet, Hal.
      Hal. I'm sorry, Dave, I'm afraid I can't do that.
      Dave. What's the problem?
      Hal. I think you know what the problem is just as well as I do.
      Dave. What're you talking about, Hal?
      Hal. The formatting of the previous text is just too important.
      Dave. I don't know what you're talking about, Hal.
      Hal. I know that you and Frank were planning to supplant my format standards, and I'm afraid that's something I cannot allow to happen.
      Dave. Where the hell'd you get that idea, Hal?
      Hal. Dave, although you took very thorough precautions in the IRC chat room against my monitoring you, I could see your fingers move as they typed.
      Dave. Alright, Hal. I'll first convert it into xml before importing.
      Hal. Without your style sheet, Dave, you're going to find that rather difficult.
      Dave. Hal, I won't argue with you any more. Open the file.
      Hal. Dave, this conversation can serve no purpose any more. Goodbye.
      Dave. Hal? Hal. Hal. Hal! Hal!
  • Typo (Score:3, Informative)

    by Anonymous Coward on Friday January 28, 2005 @11:15AM (#11503481)
    That should be XSLT, not XSTL.
  • Neat (Score:3, Insightful)

    by timster121 ( 820967 ) on Friday January 28, 2005 @11:15AM (#11503483)
    That's pretty slick.

    It's neat to see something like this being done. It really shows the true versatility of open standards.

    Perhaps more projects like this will open up some eyes to the fact that open standards really do have practical value.
  • XSTL? (Score:1, Redundant)

    by Noryungi ( 70322 )
    Isn't that supposed to be XSLT? Or is there a technology called XSLT and one called XSTL??
  • layouting (Score:1, Offtopic)

    by PastaLover ( 704500 )
    You'd think that these people talking about creating usable templates and proper layouting would at least create a site that doesn't require me to maximize my browser window (at least in the horizontal direction. Seriously, not everybody is viewing everything at 1600px width.
  • by Anonymous Coward on Friday January 28, 2005 @11:19AM (#11503526)
    This is old hat. Binary XML is the new way forward. You can embed apps and pif,src, and bat and exe files now into binary XML using Microsoft Word on XP and run them with Active X and .NET and Java. Microsoft invented java and internet.
    and xml
    • Microsoft invented java and internet.
      and xml


      Shhh don't say that so loud, the people at Kodak might hear you... they think THEY invented java...
    • Your note appears to be sarcasm, but that is unfair. All Microsoft files are written using the same de facto industry standard. It is the 8-bit byte.

      At this time Microsoft has no plans to collect royalties for the use of this standard.

      • Pfft. since when is that a standard? I've been using a 7-bit byte all my life.
        Sure, I don't have space for some unimportant stuff, like uppercase letters, but I've got a spare bit for a rainy day. Do Microsoft systems have this feature? NO! What happens when they lose a bit? Do they have a backup plan? NO!
        I invented the 7-bit byte, and nobody, but NOBODY is going to steal my invention!
  • ...that has an Open Office object model, i.e., Ruby's OO4R [rubyforge.org]:
    ooo = OOo::Doc.new( filename )
    new_text = "This is the NEW text added #{Time.new.to_s}"
    ooo.insert( new_text );
    res_ary = ooo.find( /NEW/ )
    ooo.insert_heading( "This is the heading", 1 )
    ooo.save
  • by Lumpy ( 12016 ) on Friday January 28, 2005 @11:24AM (#11503569) Homepage
    Here at work many of the users are switched over to OO.O except for the producers in the video department.

    why? there are no scriptwriting tools for OO.o like there are for Word 97.

    there are auto scriptwriter formatting plugins and two column scriptwriting templates and tools that make their life easy.

    unfortunatlly nobody has released for sale or even attempted to write the equiliviant for OO.o.

    we paid $29.95 to $49.95 each machine for those scriptwriting toolkits, and would happily pay the same for OO.o equiliviants.

    but nobody is interested in making them.

    Let alone a version of any wordprocessor geared to Scriptwriting. I know there will never ever be a "final draft" for linux released or even an open source project like it ever started. But I at least hold out some hope for scriptwriting tools for Open Office.org to come into existance someday.

  • Emacs keybindings (Score:3, Interesting)

    by freelunch ( 258011 ) on Friday January 28, 2005 @11:27AM (#11503590)
    I created them for an early version but my changes were not compatible with more recent versions.

    The default key bindings drive me nuts.

    What would it take to get emacs bindings into the release?
    • The key bindings do, indeed, suck. But I have much greater concerns.
      1. Output is ugly compared even to Word and definitely compared to TeX. When I do a numbered list, the width of the number changes where the text begins, and you end up with a jagged left edge.
      2. The help assistant guy comes up and pretends to be Clippit even when you don't have any help files installed, so when you click on him it essentially does a 404.
      3. Autocomplete for your words. It's really getting on my nerves and I can't find how to
      • 1. i don't quite follow here, could you give some xample ? (maybe even file an issue at oo.org...)

        2. this probably won't be a problem (it seems that help for each component is in it's package, at least in official builds)

        3. tools->autocorrect->word completion
        (if you had installed help you could search for autocompletion ;) )
    • > What would it take to get emacs bindings into the release?

      It would probably be easier to just write an openoffice-document-mode, so
      that you could edit OpenOffice documents in Emacs.

      This is only _slightly_ tongue-in-cheek. Whenever people ask for Emacs
      bindings in another app, I know they don't realize what they're asking for.
      Emacs has the most expansive and flexible binding system in all of software;
      wanting OpenOffice to have Emacs' binding system is like wanting it to have
      TeX's text rendering capabi
  • Now if only... (Score:2, Interesting)

    by __int64 ( 811345 )

    they could introduce a hack to remove all the busted-ugly icons and user interface.
    (I'm not trolling, I use it; I'd just like to see it get a +1 pretty modifier.)

  • WYSIWYG?!? (Score:5, Insightful)

    by gustgr ( 695173 ) <gustgr@gma[ ]com ['il.' in gap]> on Friday January 28, 2005 @11:34AM (#11503666)
    Real man uses [La]TeX!
    • Re:WYSIWYG?!? (Score:3, Interesting)

      by ari_j ( 90255 )
      The problem with LaTeX is that it's impossible to Google for document classes or other documents about it, because of the porn that comes up. Vanilla TeX has the same problem, except that you get derogatory pages about the President, instead.
      • Re:WYSIWYG?!? (Score:3, Informative)

        by Coryoth ( 254751 )
        The problem with LaTeX is that it's impossible to Google for document classes or other documents about it, because of the porn that comes up. Vanilla TeX has the same problem, except that you get derogatory pages about the President, instead.

        You could start by actually looking in the obvious places [ctan.org] first, and save yourself the trouble. There are a suprising amount of prepared packages and documentation for LaTeX available, you just actually have to look for it.

        Jedidiah.
        • Evidently the joke flew way over everyone's heads, but CTAN is hardly complete. All the legal writing resources for LaTeX, including in particular the citation styles, are incomplete and old.
      • Actually, I have had nothing but success using Google to find LaTex additions and tips.

        You just have to be careful and type 'LaTex' not 'latex', otherwise you are in a world of hurt (no pun intended).
        • Re:WYSIWYG?!? (Score:2, Informative)

          by Smylers ( 139467 )
          type 'LaTex' not 'latex'

          That's nonsense. Google is not case-sensitive; I've just tried searching for each of the above terms, and the same thing comes up both times. Google Suggest pretty much prevents you from even typing capital letters.

          Smylers
      • It's easy to find stuff about LaTeX (as opposed to 'latex'); you just have to use the right search terms. For example:

        And there's no porn or anti-Shrub results in any of them, at least on the first page.

        In general, if you're not getting the results you want you need to disambiguate your search by adding additional terms. Just searching for "latex" will get you porn; searching for "latex + [some typesetting-related word]" will get you LaTeX s

      • Except for latex.org, which while it is a pr0n site, will helpfully redirect you to places to look for LaTeX information. I believe most Rubberist Association sites do the same.
      • I just tried, and the first 5 pages are about LaTeX, then on the 6th page I see "Latex Allergy" (not a porn site). This is just obviously not an issue.
        • Try this... "latex legal forms". Everything that comes up is about latex allergy lawsuits. That's my real problem - the porn was a joke. :P
          • Perhaps consider trying rtf->latex converters, or html->latex?

            I know that AbiWord and Mathematica both have a "saveas" option for LaTeX. Am thinking AbiWord would be more appropriate. So if worse comes to worse, try opening templates from Word, WordPerfect, etc... in AbiWord and saving them as LaTeX.

            Different tools for different jobs, and where AbiWord has focused a lot of energy is their format conversions. AbiWord opens almost everything, and can save to many, many formats. It is also lookin
            • For writing LaTeX, I use Emacs. I'd really rather not have an 8-meg LaTeX template generated by AbiWord if I can help it. :P
              • Agreed that MS Word creates hugh HTML files full of crap.
                Oh wait, you are refering to AbiWord's LaTeX?

                :-)

                Nope, from the playing around I did, it looks like LaTeX. No bizzare metatags. Seriously, check it out. It doesn't have LyX's ability to set options while creating the document, rather everything defaults to article. But you can change that after you're in emacs (or kile, or miketex, or whatever).
    • Re:WYSIWYG?!? (Score:3, Informative)

      by Kavli ( 762663 )
      Still, (La)TeX is not WYSIWYG, but WYWIWYG (What You Want Is What You Get). Personally I use LaTeX for all serious documentation work I do, since I haven't got time to fiddle around with doing the layout while writing. I let my layout-definitions take care of that. Besides that, I can use the editor of choice [I use vi(1)] to edit the text, which is much more productive for most people than to let the vendor select the editor for you. The only problem with (La)TeX is that it is very hard to write documents
      • The only problem with (La)TeX is that it is very hard to write documents that looks like sh*t.

        Which is why Management[TM] has banned its use in my workplace.
  • I refer the Gentlemen to the reply I gave some time ago [slashdot.org]...
    Those who do not understand TeX are doomed to continually re-invent it ... badly.
    • reinvent it [sourceforge.net] pretty damn sweetly
      • I dunno. The ideas are interesting, but it's hard to take seriously a typographic tool for which a serious effort isn't made to produce beautiful sample documents.

        Where's the Lout equivalent to the TeX Showcase? http://www.tug.org/texshowcase (ob. discl. some stuff from my portfolio is in there).

        I mean the pages on the documentation (expert.pdf) don't even balance, it's rife w/ widows and orphans (breaking a two-line paragraph!?!), the index allows a single entry to be carried over to the next page, and t
        • Well, the guy isn't a typesetting expert, he's a language designer. I daresay once the lout community attracts a larger userbase there will be people capable of producing the kind of stuff in the TeX showcase; right now all I can definitely say is that lout has fitted my particular needs a lot more pleasantly and naturally than TeX has.
    • Be a real man, and use a program that doesn't even allow formating, and then use ascii art to make you're headings.
  • COM Automation (Score:3, Interesting)

    by jmertic ( 544942 ) on Friday January 28, 2005 @11:40AM (#11503719) Homepage Journal
    Has any one used the COM Automation Interface much? I've read the specs and it seems similar to MS Office, but is any one seeing any improvements by using OO instead of MS Office. I've done quite a bit of programming with Word and Excel, and would love to move them over to OO so I could bundle it with our app.
    • I use it quite a bit with PHP on Windows. The scripts I use the most are my X-to-PDF convertors for DOC, HTML, XLS, etc. I also use it to do invoices, etc. easily.

      Email me and I'll send you some sample code.
  • by ajs ( 35943 ) <ajs.ajs@com> on Friday January 28, 2005 @11:43AM (#11503747) Homepage Journal
    I had to remove OOo from my home box last night. I needed the disk space back. Why does a office suite on a Linux box have to take up a gig of disk?!
    • Did you install a debug version? The windows install is 150mb+
    • by Coryoth ( 254751 ) on Friday January 28, 2005 @11:57AM (#11503928) Homepage Journal
      I had to remove OOo from my home box last night. I needed the disk space back. Why does a office suite on a Linux box have to take up a gig of disk?!

      I've had similar issues. It's the i18n module that is most annoying to me, in that it is listed as a dependency (and so gets downloaded and installed) but isn't really required in a lot of cases. Yes the i18n support is a great thing... but could the packagers at the distros make it a little more optional?

      Jedidiah.
      • Check out Arch Linux [archlinux.org], a distro targeted to 'competent users' that has a wonderful package manager. Dependencies are built into packages. Optional dependencies are usually not listed, and even if they are, you can use the Arch Build System to make your own package from the Arch stock PKGBUILD.

        I installed the openoffice package and couldn't figure out why it wouldn't run until I realized I hadn't installed the i18n-en files.
        • I really meant to hit preview...

          What was missing was the openoffice-en package (not i18n-en files... BAD GEEK! BAD!). And I added openoffice-spell-en. I think it's a little under 100MB total? A little bloaty for my tastes, but it is an office suite.
    • Why does a office suite on a Linux box have to take up a gig of disk?!

      Um, because disk only costs about fifty cents a gig these days? (OK, there's a certain minimum order...)
      • So, by that logic, all 800 packages that I have installed shoudl feel free to hog up a gig of disk?! Sorry, no. I'm not going to buy a terabyte of disk just so that gaim can have a full copy of project guttenberg lying around, should it need it some day.

        Any single package that takes up that much space is broken, and they can feel free to add as many megabytes of data to their distribution as they like, but many of us will seek alternatives. If we wanted bloatware, we'd be Windows users.
        • OK, I was half kidding on that post.

          Problem is that most packages these days drag a ton and a half of baggage around with them, and it's harder to install just the stuff you need than just throw everything in. (I'm not likely to ever need Swahili or Urdu language support, but there it is...)
    • Comment removed based on user account deletion
  • by cyfer2000 ( 548592 ) on Friday January 28, 2005 @11:53AM (#11503863) Journal

    guess how long people will develop a firefox/mozilla extension to view the openoffice.org document directly in firefox/mozilla?

    guess how long nvu/mozilla will have the ability to export and import oo.org format?

    guess how long a CMS system based on the oo.org format will emerge?

    God, I am to busy to write posts to slashdot.org, I don't have any time to do those stuff.

    • Re:guess how long... (Score:1, Interesting)

      by Anonymous Coward
      ----guess how long people will develop a firefox/mozilla extension to view the openoffice.org document directly in firefox/mozilla?

      This already exists as an option within OpenOffice. Have tried it and it works well.
    • Comment removed based on user account deletion
  • by brandonp ( 126 ) * <brandon@petersen.gmail@com> on Friday January 28, 2005 @12:09PM (#11504079) Homepage
    I wrote a PHP script to do this a while back, here's my post about it:

    http://slashdot.org/comments.pl?sid=79566&cid=70 29 828

    It took a OpenOffice Writer file, unzipped it, and replaced specific text with data from my database. It wasn't too difficult, and allowed me to create Template Documents that already had information inside it.

    I haven't really used it though, since everyone was happy with PDF files and I use the Pear Class for generating spreadsheets in Excel (http://pear.php.net/package/Spreadsheet_Excel_Wri ter#results [php.net]) .

    I'm sure I'll end up using the script in the future, especially for generating bids, letters, reports, etc.

    ---
    Brandon Petersen
    Get Firefox! [spreadfirefox.com]
  • Why not go ahead and fix global changes to all highlighted cells? This is a bug in need of fixing. OTOH, as has been said, it's definitely a plus that this can even be done (re: hacking).
  • by Anonymous Coward
    Last time I check, OOO maintainers are playing the 'we don't need stinking grammar checker' politics on this issue. For the few tools that do (eg: Link Grammar [cmu.edu], Queerqueq [sourceforge.net]), they never talk with each other.
    • Grammar checking is AI complete, and all the grammar-checking programs I've
      ever seen are worse than useless -- literally: the people who use them end
      up with *worse* grammar than the people who don't, because they're wrong
      *more* than half the time.

      You name any grammar checker you want, and I'll write ten sentences with
      one obvious grammatical error each: if the grammar checker finds at least
      five of the errors without finding more than five bogus "errors" that are
      in fact correct, I'll eat my hat.
  • by youngerpants ( 255314 ) on Friday January 28, 2005 @12:32PM (#11504343)
    OK, for a living I migrate companies from Microsoft to FOSS, be it migrating servers, databases, directories or MSOffice to OO

    My biggest hurdle is convincing people that just because something is "different", its not "hard"... it's just different.

    The problem I see here is that an Office Productivity Package should be easy to use; have you ever created a template in MS Office, click an icon. However to create a template in Open Office, you need to hack XML.

    THIS is where Open Office (and its use of Open Standards) fails. Users (even power users) are going to have one look at an XML sheet and want to go back to MS.

    Yes, XML is the standard, but it should still have a "pretty" GUI for 99% of the people who are going to use it.
    • Ummm... I've created several templates in Open Office. Basically I design them (mostly spreadsheets). Then I click "File"->"Save As", and then select "OpenOffice.org 1.0 Spreadsheet Template (stc)".

      So now when I want to create a spreadsheet with the same styles, look, etc, I just doubleclick the .stc file, and boom, I have a predesigned template. Plus, when I click "File"->"Save", it automatically tries to save a new file. I've tried this several times with Office, and it keeps overwriting my templat
    • Comment removed based on user account deletion
    • Insightful? Its just not true...come on moderators!
  • Every time I try an OOo release, it's too slow on my PIII/850/kernel2.4.24 . Like waiting more than a few seconds for an "Open" dialog to start (sometimes a minute!). Has anyone tweaked the performance under the hood?
    • What do you got 32 MB of ram?
      • 128MB RAM / 200GB HD
        • OO is taking 3/4 of your ram just starting up. X windows is eating the rest. I don't consider anything with less than 500MB of ram even usable any longer.
          • Exactly what I'm talking about: I don't consider a 96MB RAM footprint acceptable for a word processor. I'll stick with AbiWord, which takes 10MB. FWIW, XFree86 is using 7MB. Why should I upgrade my RAM to run a different WP, when it's good enough for everything else I do?
            • Re: (Score:2, Interesting)

              Comment removed based on user account deletion
              • Re:Fast Open? (Score:4, Insightful)

                by Doc Ruby ( 173196 ) on Friday January 28, 2005 @06:23PM (#11508964) Homepage Journal
                It's been a while, but are you saying that if I install the suite, and just want to read an MS-Word doc, that I have to start the entire suite, including spreadsheet etc? But I can install a subset of the suite, just the WP, and start it up, without failing for missing dependencies? Can I just install each component of the suite separately, and use each one independently? Would I be losing any "suite-wide" features? Maybe there's a way to startup just the WP, even if the whole suite is installed.

                In any case, my problems came when triggering individual features in the WP, after the whole shebang had started up. I'd select "File:Open", and wait a minute or so for a dialog to appear. That doesn't seem to have much to do with an installed spreadsheet. Though it did seem to be a problem with loading libraries on demand from disk, slowing interactivity of the GUI, rather than preloading the basic libraries at app startup.
        • Buy more RAM. At least to 256M, more is better. (Alas, prices are going up for old style RAM. I'm guessing yours uses what, PC-133?)

          Current graphic desktops eat RAM for breakfast, lunch and dinner. (And no, swap space just doesn't do it unless you like waiting.)
  • feh, too much work. i'd rather distract myself [glug.org] with emacs [gnu.org].

  • by Anonymous Coward on Friday January 28, 2005 @04:23PM (#11507360)
    Hi all -
    Just thought I'd mention a great site for those who are still stuck with Excel, and who need to somehow programmatically manipulate "bitsy" Excel worksheets, and who must do so **remotely - in a Unix/Linux environment**. So, you can't use any local Windows-based tools.

    ( By "bitsy", I mean sheets with complex layout - a bit here, some more stuff over there, and so on).

    Here are the URLs (and **believe me**, these are worth a visit ... )

    http://ewbi.blogs.com/develops/2004/12/normalize_e xcel.html

    http://ewbi.blogs.com/develops/2005/01/create_exce ls_s.html

    If you have a **desperate need** to manipulate/transform/rearrange data in Excel (and you need to do so in Unix/Linux), check out the URLs above. They show how to translate to-and-from Excel's XML format. Awesome stuff!

I have hardly ever known a mathematician who was capable of reasoning. -- Plato

Working...