Bug 35959 - FORMATTING: default Page Format for plain txt files not adjustable
Summary: FORMATTING: default Page Format for plain txt files not adjustable
Status: RESOLVED WORKSFORME
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
3.3.2 release
Hardware: x86 (IA32) Linux (All)
: medium minor
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
: 41386 (view as bug list)
Depends on:
Blocks:
 
Reported: 2011-04-04 09:07 UTC by enigma
Modified: 2012-05-04 03:49 UTC (History)
4 users (show)

See Also:
Crash report or crash signature:


Attachments
plain text file for testing purposes (2.86 KB, text/plain)
2012-03-01 09:06 UTC, enigma
Details

Note You need to log in before you can comment on or make changes to this bug.
Description enigma 2011-04-04 09:07:16 UTC
Hello

I reported this matter earlier in the year and I thought it was repaired but I cannot find the original bug report to add this info on. Too many accounts and too many passwords.

My LibreOffice defaults to A4 page format with my en_GB locale. I want Letter. My previous bug report ended with instructions on how to create a default template with the new page size. Thank You. The instructions were good. When I opened LibreOffice the new page size by default was Letter.

Unfortunately, the new default template is not loaded in all situations.

If I open Konqueror in my Debian Testing KDE by secondary click on a text document and choose Open With . . . > LibreOffice writer, the default template is bypassed and the page format is back to A4.

Let me put it another way.

"libreoffice -writer %U" appears to bypass picking up a preferential default template before a document is loaded.

Hope this helps.
Comment 1 enigma 2011-04-06 09:11:09 UTC
Added info

Original bug was 35740 but this bug does not apply to localisation
Comment 2 Björn Michaelsen 2011-12-23 11:45:13 UTC
[This is an automated message.]
This bug was filed before the changes to Bugzilla on 2011-10-16. Thus it
started right out as NEW without ever being explicitly confirmed. The bug is
changed to state NEEDINFO for this reason. To move this bug from NEEDINFO back
to NEW please check if the bug still persists with the 3.5.0 beta1 or beta2 prereleases.
Details on how to test the 3.5.0 beta1 can be found at:
http://wiki.documentfoundation.org/QA/BugHunting_Session_3.5.0.-1

more detail on this bulk operation: http://nabble.documentfoundation.org/RFC-Operation-Spamzilla-tp3607474p3607474.html
Comment 3 enigma 2011-12-23 12:35:50 UTC
Good Day

I received am automated message advising me to load the latest copy and try for the bug.

I downloaded 3.50 beta1 and I can confirm the bug is still present.

If it is applicable, Season's Greetings.
Comment 4 sasha.libreoffice 2012-02-27 05:37:09 UTC
Sorry for nobody replies so long time. My be people afraid experiment with templates.
I have one question: You have changed default template or selected another file as template and initial template remains unchanged?
Comment 5 enigma 2012-02-27 14:13:30 UTC
Thanks for the reply

My LO 5.0 is setup for en_gb. This defaults to an A4 paper size. I use Letter.

I opened LO and changed the paper size to Letter along with my favourite font, margins and indents. I saved the template as per the procedure and I designated the new template as the default.

I open LO and all is good with the new template.

The problems begin when I open a text document. LO reverts to A4 and the generic settings overriding the new template.

It also happens when I use
#     /opt/libreoffice/program/swriter /home/???/???/text_document.text

The settings come out as the original default template.

Hope this helps.
Comment 6 sasha.libreoffice 2012-02-28 02:36:13 UTC
Thanks for additional information. So, I have some questions:
- What happens if create new document, save it and start it again? It remains Letter or becomes A4?
- What happens if delete or rename original template (so document will not find it) ?
- What is in File->Properties, on first tab, on bottom after word "Template"?
Comment 7 enigma 2012-02-28 08:55:16 UTC
Thank You for the quick reply

Your questions answered.

1)   I saved a document as test.odt with my new customised template loaded as default. The document was then reloaded. It retained the properties of the new template with paper size as Letter.

Note:   My problem seems now only to occur when I load a text document.

2)   I deleted the new template and restarted LO. There is no option to rename. A message appears "/home/???/.config/libreoffice/3/user/template/my_default1.ttt does not exist." I click OK and LO opens with the out of the box default template with properties such as A4 paper size.

3)   With LO using the out of the box default template, nothing follows 'Template:'. With LO using my customised new template, the line looks like "Template: my_default".

Added Info:   With my customised template loaded, I open a pure text document. Under File>Properties>General(first tab) the line looks like "Template:" with nothing following.

Hope this helps.
Comment 8 enigma 2012-02-28 08:57:16 UTC
My apologies a mistake.

"/home/???/.config/libreoffice/3/user/template/my_default1.ttt does not exist."

should read

"/home/???/.config/libreoffice/3/user/template/my_default1.ott does not exist."
Comment 9 Cor Nouws 2012-02-28 12:58:30 UTC
Hi,

(In reply to comment #5)

> The problems begin when I open a text document. LO reverts to A4 and the
> generic settings overriding the new template.

When you open an existing document, it will not be changed because there is some (new/different) default template...
So IMHO this is not a bug ?!
Comment 10 Cor Nouws 2012-02-28 12:59:34 UTC
pls do not touch the version field. That is here to refer to the version for which the issue was submitted :-)
thanks - Cor
Comment 11 sasha.libreoffice 2012-02-29 01:07:25 UTC
Thanks for answers. So how I understand:
1) Documents, created with new template, opens correctly.
2) I mean this:
- do File->Templates->Organize and select template with desired paper size (may be previously created)
- right click on it and select "Use as default template"
- delete or rename previos default template
- start document that known that previously opened with wrong paper size
3) try Tools->Options, LibreOffice Writer->Printer, field "Paper tray from printer settings"
and  Tools->Options, LibreOffice Writer->Compatibility, field "Use printer metrics for document formatting"
Comment 12 enigma 2012-02-29 14:38:04 UTC
Thank You for the replies.

Cor Nouws:

- The subject of this bug that I am having problems with are text documents being loaded not .odt documents or any previously formatted documents. The text documents are completely unformatted so LO should not choose to change templates. One is as good as the other except for me Letter page size is required. :-)
- No changes

sasha.libreoffice@gmail.com:

1) "Documents, created with new template, opens correctly."

  Yes

2) "I mean this:
- do File->Templates->Organize and select template with desired paper size (may
be previously created)
- right click on it and select "Use as default template"
- delete or rename previos default template
- start document that known that previously opened with wrong paper size"

  I loaded a text document with a brand spanking new template and the paper size was wrong
  
3) "try Tools->Options, LibreOffice Writer->Printer, field "Paper tray from
printer settings""

  I do not have a Printer option, I have a Print option. I checked the box.

"and  Tools->Options, LibreOffice Writer->Compatibility, field "Use printer
metrics for document formatting""

  I did this and loaded a text document. The results were the same with the wrong page size.

Further Info:	I modified the printer settings to use Letter and I saved these with a new default template. When I loaded a text file the printer settings reverted back to A4.

  The bottom line is that so far all 'permanent' changes to templates and printer settings are lost when loading a text document. The new customised necessary settings are completely ignored.

Hope this helps.
Comment 13 sasha.libreoffice 2012-02-29 21:43:52 UTC
Thanks for additional testing

> - The subject of this bug that I am having problems with are text documents
> being loaded not .odt documents or any previously formatted documents.
Please, write: which exactly format of files used. May be even attach one if it contains no secret information.

May be in such situation LibreOffice uses template from somewhere in /opt/libreoffice3.5 
for example this /opt/libreoffice3.5/share/template/en-US/internal/html.stw
or uses hardcoded values
Comment 14 enigma 2012-03-01 09:06:22 UTC
Created attachment 57867 [details]
plain text file for testing purposes
Comment 15 enigma 2012-03-01 09:17:04 UTC
Thank You for the reply.

I lost part of my response when I attached the test file. You may find it someplace.

"Please, write: which exactly format of files used. May be even attach one if it
contains no secret information."

Please see attached made-up test file test.txt as saved by KDE kwrite using UNIX end of line.

When LO was loaded I checked the settings. In page format the page is Letter. In printer settings the page is Letter. After the test.txt file was loaded the page format and printer settings both reverted back to factory settings of A4.

"May be in such situation LibreOffice uses template from somewhere in
/opt/libreoffice3.5 
for example this /opt/libreoffice3.5/share/template/en-US/internal/html.stw
or uses hardcoded values"

I looked in the directory but sorry like to help on this but it is above my pay grade. :-) One thing though I am not using en-US. I am using en-GB for my internal language and my default KDE language.

Hope this helps.
Comment 16 sasha.libreoffice 2012-03-02 01:35:32 UTC
Thanks for attachment. Alas, I do not know how fix this problem.
As temporary solution, You can use this Basic macro:

Sub SetPageSizeLetter()
	Dim oDoc as Object
	oDoc = ThisComponent
	oStyle = oDoc.StyleFamilies.getByName("PageStyles").getByName("Default")
	' units of 1/1000 cm
	oStyle.Width = 21590
	oStyle.Height = 27940
End Sub

Copy-paste it to existing macros, assign it to Menu or Toolbar or Keyboard shortcut
Then use this macro each time when opening txt file to quick change format
If appears some question, please, tell me. Meanwhile I will ask expert.
Comment 17 sasha.libreoffice 2012-03-02 01:40:58 UTC
@ Michael
Sorry for spend Your time. Please, look at this bug when will have time.
Short description: When we open plain text file in Writer, page format appears A4 by default. How change it so that txt files opens as Letter page format?
Comment 18 sasha.libreoffice 2012-03-02 07:07:44 UTC
*** Bug 41386 has been marked as a duplicate of this bug. ***
Comment 19 enigma 2012-03-03 11:41:05 UTC
Thank You for the reply

I will use your macro until issue resolved - hopefully within next couple of versions.
Comment 20 Cor Nouws 2012-03-03 15:06:28 UTC
In tools > Options > Language settings change Locale to e.g. English US - which has Letter as default size - and then a plain new txt file will have Letter size when you open it and look at Format > Page.
Thus - apart from the great macro -  it already can be done as desired.
Sorry I did not understand this earlier :-)
Comment 21 enigma 2012-03-03 18:12:58 UTC
Cor Nouws - Thank You for the reply.

Your suggestion would certainly help unfortunately it is not an option. The differences between the two languages such as spelling and forms of measurement make the switch impossible.

I have even gone so far as to research a language that uses English spelling, metric measurements and Letter page size but I have been unsuccessful.

Hope this helps.
Comment 22 Cor Nouws 2012-03-04 01:33:08 UTC
hi enigma,
Oh, sorry to read that this is not an option for you.
Initially I had some trouble to understand the request and as for now, I must confess that I do not understand what the use case of this is: why do you need to work it like you ask, and why it is to hard to set Format > Page to letter before e.g. printing?
Comment 23 enigma 2012-03-04 06:53:28 UTC
Cor Nouws - Thank You for the reply

"and why it is to hard to set Format > Page to letter
before e.g. printing?"

I have been using your suggestion for many years. So far it was and is the only work around that I can find. I used it with OO and I use it with LO.

Printing is only one component and so is page size. My duties include taking somewhat large plain text files and making them presentable. The page setup must be done for everything that I do with a plain text file. I open a file. I set the page. I Select All and change Preformatted Text to Default. I goto Printer Settings and change A4 to Letter. I must modify one style that I use. My customised template is just pushed aside.

I make mistakes (occasionally ?). In one instance I did a multi page document and saved it as a .odt file and distributed it. Unfortuately I did not change the page size or printer settings. Very embarassing! Memory must be perfect to work in this environment. It is easy to say change it but it must be dome 100.000% of the time.

Templates are believed to be able to customise the document environment to your personal settings. It doesn't work here.

Hope this helps
and
Thank You again
Comment 24 enigma 2012-03-04 07:07:33 UTC
Hello

Writing about memory was very true. I forgot one option that I have.

I can open LO with my customised template and then copy and paste the plain text into the document. This way I loose nothing. I can remember maybe three instances where this did not work and they dealt with the source text editor.

A problem with this workaround is the use of DOS and UNIX line endings. The user is not faced with an option box of how to import the text.

If LO changes it's policy to only allow cutting and pasting text files because the template issue is too complex then this is an ALMOST 100% solution.

Hope this helps
Comment 25 Cor Nouws 2012-03-04 11:14:05 UTC
(In reply to comment #24)

> I can open LO with my customised template and then copy and paste the plain
> text into the document. This way I loose nothing. I can remember maybe three
> instances where this did not work and they dealt with the source text editor.

In a new file, choose Insert > File..

> If LO changes it's policy to only allow cutting and pasting text files because
> the template issue is too complex then this is an ALMOST 100% solution.

Maybe Edit > Paste special could help here.

Thanks for your explanation,
Cor
Comment 26 Roman Eisele 2012-05-04 03:49:32 UTC
This is a Writer issue, therefore changed the 'Component' field appropriately.