1

Let's say I leverage the info in these following answers..

to creat a "New RTF Document" menu item to Initiate/ Invoke creation of a RTF Document.


How, can I get "Word 2010" and "Write/ Wordpad" to default to do so, using a Narrow (0.5) or Custom Page Layout?


  • I know I can change Margins after opening the document. But to do it every time for every New RTF is too much effort.

  • Also, I know there are some "Default" templates/ mechanisms that Word defaults to when it creates a New Document

But I am not sure if and how I can leverage them to work/ apply when a file's created via the context menu "New > RTF Document"?

  • Current OS: Win 8.1 Pro - 6.3 Build 9600
  • Microsoft Office 2010

Update: Export from Registry key for RTF:

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT.rtf] @="Word.RTF.8" "Content Type"="application/msword" "PerceivedType"="document"

[HKEY_CLASSES_ROOT.rtf\OpenWithList]

[HKEY_CLASSES_ROOT.rtf\OpenWithList\WordPad.exe] @=""

[HKEY_CLASSES_ROOT.rtf\OpenWithProgIDs] "calibreViewer64bit.AssocFile.RTF"=hex(0): "calibre64bit.AssocFile.RTF"=hex(0):

[HKEY_CLASSES_ROOT.rtf\PersistentHandler] @="{2e2294a9-50d7-4fe7-a09f-e6492e185884}"

[HKEY_CLASSES_ROOT.rtf\ShellEx]

[HKEY_CLASSES_ROOT.rtf\ShellEx{8895b1c6-b41f-4c1c-a562-0d564250836f}] @="{84F66100-FF7C-4fb4-B0C0-02CD7FB668FE}"

[HKEY_CLASSES_ROOT.rtf\ShellNew] "ItemName"=hex(2):40,00,25,00,50,00,72,00,6f,00,67,00,72,00,61,00,6d,00,46,00,\ 69,00,6c,00,65,00,73,00,25,00,5c,00,57,00,69,00,6e,00,64,00,6f,00,77,00,73,\ 00,20,00,4e,00,54,00,5c,00,41,00,63,00,63,00,65,00,73,00,73,00,6f,00,72,00,\ 69,00,65,00,73,00,5c,00,57,00,4f,00,52,00,44,00,50,00,41,00,44,00,2e,00,45,\ 00,58,00,45,00,2c,00,2d,00,32,00,31,00,33,00,00,00 "Data"="{\rtf1}"

[HKEY_CLASSES_ROOT.rtf\Word.RTF.8]

[HKEY_CLASSES_ROOT.rtf\Word.RTF.8\ShellNew]

  • That's a great question. It can be done only if you've associated .RTF files with Winword, instead of Wordpad. Pl confirm which program you've associated .RTF files with. – w32sh Aug 12 '16 at 13:37
  • Right now it's associated with word as office 2010 was installed and word took over the association. But curious if it's at all doable on system without word/ office and only Wordpad. Does Wordpad use a default kinda thing like word? – Alex S Aug 12 '16 at 13:46
  • WordPad simply ignores the page layout meta data stored inside the RTF, and uses the default margin settings for all documents. Whereas Winword respects it and uses per-document page layout settings. – w32sh Aug 12 '16 at 13:57
  • Then please guide me how to do this for word RTF – Alex S Aug 12 '16 at 14:09
2

Create a sample .RTF file using Microsoft Word

Create a RTF file using Microsoft Word, with the desired margin settings and page layout options. Save the file as template.rtf in the following folder:

%AppData%\Microsoft\Templates

Backup .RTF file type settings

Open a Command Prompt window, and run the following command to backup the existing .RTF file type settings:

reg export hkcr\.rtf  %userprofile%\desktop\rtf_fta.reg

This creates a file named rtf_fta.reg on your desktop.

Apply the REG fix below

Copy the following contents to Notepad and save the file with .REG extension, let's say rtf_template.reg. Double-click the file to apply the settings in the registry.

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\.rtf]
@="Word.RTF.8"

[HKEY_CLASSES_ROOT\.rtf\Word.RTF.8\ShellNew]
"FileName"="template.rtf"
"NullFile"=-

That's it. When you create a new .RTF document from the right-click menu, it uses template.rtf as the source or template file, and the newly created file will have the same page layout settings as the source.

This above applies only if you open .RTF files using Microsoft Word.

Note: After running the REG file, you may in some cases need to re-associate .RTF file types with Microsoft Word using the Open with dialog.

  • I will try this out over the weekend and get back – Alex S Aug 13 '16 at 7:28
  • Updated with Export of RTF Reg key: So, the Word Doc/x template is Normal.dotm - Should the template for RTF be .RTF or something else (better naming syntax) Or It kind of doesnt matter due the registry entry pointing to that file? - Also, found this - I'm wondering if this is extraneous or has some usable info here: rtftemplate.sourceforge.net/userguide/design-rtfmodel/… – Alex S Aug 15 '16 at 11:54
  • Word Templates vs ShellNew Templates - both are different things. Simply create and customize the file named template.rtf - and place in that location... that should be enough. – w32sh Aug 15 '16 at 12:10
  • Ah! Interesting, I thought there was some linkage here. So/ but I still have to create a "New RTF Document" in the context menu here.. using the above posted links or your answer is complete does it automatic? PS: I didnt see a New RTF item on the Context menu – Alex S Aug 15 '16 at 12:12
  • Yes, you create a new .RTF document as usual from the New menu -- The new RTF file will now use the same settings as the template file. – w32sh Aug 15 '16 at 12:14
1

My system = Windows 10 Pro/64bit. What worked for me:- I placed my default RTF template in:

"%AppData%\Microsoft\Windows\Templates\"

I called my template file:

   "RTF_Windows_Template.rtf"

I edited the following Registry Key (I did not touch the key's default value. ); add the key if it is missing:

   HKEY_CLASSES_ROOT\.rtf\ShellNew

I added/edited the following entry under this key:

HKEY_CLASSES_ROOT\.rtf\ShellNew Name:FileName; Type:String (REG_SZ); Data: RTF_Windows_Template.rtf

I added/edited the following entry under the same key (I did not enter anything in its Data Value): HKEY_CLASSES_ROOT.rtf\ShellNew Name:NullFile; Type:String (REG_SZ)

The result when using the background context "New" menu was that "Rich Text Document" appeared and the resulting new file was based on my template.

I hope this is of use to others.

  • Is there a general template location I can point to so I can add a new blank visual studio solution file? – TheImirOfGroofunkistan May 30 '18 at 15:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.