LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 05-20-2009, 08:39 AM   #1
linuxqueric
Member
 
Registered: Apr 2007
Posts: 41

Rep: Reputation: 15
Create openoffice style for plain ascii text section


I want to be able to include plain ascii test sections (code) in an openoffice document. I've tried to create a new style to do this, but don't see any place to have the new style do things like turn off autoformat (smart quotes, changing -> to an arrow, etc.). And I'm thinking there's maybe other things that Writer does that would have to be turned off for a code block in the document.

I didn't see anything when I googled "openoffice writer ascii text style."

Is this something that can be done? How?

Thanks.
 
Old 05-20-2009, 10:53 AM   #2
stress_junkie
Senior Member
 
Registered: Dec 2005
Location: Massachusetts, USA
Distribution: Ubuntu 10.04 and CentOS 5.5
Posts: 3,873

Rep: Reputation: 335Reputation: 335Reputation: 335Reputation: 335
I believe that you could create an OOo Writer template that has the qualities that you want. That template would apply to an entire page. Then when you are writing your document you would make one page conform to that template (import the template) and put your non formatted text on that page.

I've only used OOo templates once so I'm not proficient at it. I imagine that you would start a new document, use the page formatting to remove the auto formatting, then save that blank page as a template.
 
Old 05-20-2009, 01:36 PM   #3
linuxqueric
Member
 
Registered: Apr 2007
Posts: 41

Original Poster
Rep: Reputation: 15
There needs to be a better way--not cool to have to devote a full separate page to a piece of code. Furthermore, if I read the OO.o stuff right, one can only use one template per document. So there needs to be a way within a given template to turn the desired formatting and auto* elements off and on.
 
Old 05-20-2009, 03:29 PM   #4
stress_junkie
Senior Member
 
Registered: Dec 2005
Location: Massachusetts, USA
Distribution: Ubuntu 10.04 and CentOS 5.5
Posts: 3,873

Rep: Reputation: 335Reputation: 335Reputation: 335Reputation: 335
You can use one template per page. The only work that I've done with templates was to create a title page for a document using a template, then make the rest of the document conform to a different template.

I'm disappointed that an OOo expert did not jump in to help. I find that people often add to a thread that has already got one reply. I think that's because more people look at the "View New Posts" rather than the "Zero Reply Threads". I do the opposite.

I found this site by using Google.

http://www.linuxjournal.com/article/7915

I get the impression that you may want to use an object that is formatted as you want it or you could link to a separate file that is formatted as plain text.

Hey. What do you know? I learned something. However you could have discovered this hours ago if you had used Google to do a little research before posting your question here.
 
Old 05-21-2009, 08:19 AM   #5
linuxqueric
Member
 
Registered: Apr 2007
Posts: 41

Original Poster
Rep: Reputation: 15
Dear Stress Junkie,

Thanks for the flame. However, you don't light my fire--you might have noticed that in my original post I did search on Google before posting.

The article you refer to talks about images/graphics in frames, not about creating a new style. There's no mention of inserting some other text document into a frame. While it mentions OLE objects, Writer help says an OLE object must be either a presentation, a drawing, a spreadsheet, a formula or a chart. No mention of text.

The author of the article you invoke explictly states, in a previous article, "Only one template can be applied to each document" (http://www.linuxjournal.com/article/7447). I suspect what you did was to use different page formats and confuse that with using different templates.

However, your idea of linking to a separate file does suggest a couple of different work-arounds, each of which seems to safely save the "code" character. In my experiments, a piece of php code that is handled with these work-arounds still works when copied and pasted back into gedit and resaved.

1. Looking at "links" in Writer help suggested that one can create a new section and insert the text document as a link in that section (options in the New Section dialog).

2. Create the bit of code in gedit and then paste it into the Writer document. This even worked after I changed the font size and used "Increase Indent" to move the section to the right.

3. It also seems to work to create a frame and paste code from gedit into the frame. In this case the font changed to the font of the main document, but changing it to 10-pitch Courier did not corrupt the code.

4. Finally, using "Insert -> File" seems to work, with these complications:
-Writer seems to want to treat a php file that has the php code embedded in html as an html file and renders it rather than pasting in the full file. The work-around for this seems to be to select the txt File Type in the Insert File dialog.
-The inserted file takes on the font type of the main document. Having created the "TextForCode" style (see below), if I select that before inserting the file, it inserts nicely formatted as code and still works when copied back to gedit and saved.

I tried pasting in a bit of code from gedit and then selecting it to create a new style ("TextForCode"). This seemed to work visually, but when copied back to gedit and saved as a .php file, it would not open in the browser. I even tried defining the style as not linked to the Default style.

These approaches are still work-arounds, however.

One would think that if Write can properly handle text that is pasted in from gedit (the work-arounds noted here), it should be possible to define a style in Writer that does the same thing. But apparently not.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Converting ISO-8859-1 to plain ASCII hsocasnavarro Linux - Software 9 12-17-2007 11:49 PM
No plain ascii editor? sunlion Mandriva 4 01-03-2006 01:35 AM
not a plain text file wazza4610 Linux - Newbie 1 11-22-2005 04:20 AM
openoffice 2- how do i create a text box? lefty.crupps Linux - Software 2 11-02-2005 10:29 PM
VIM-style wrapping to OpenOffice style schmmd Linux - Software 1 12-21-2004 06:50 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 05:17 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration