How to change the default font: ONLYOFFICE DocSpace, Desktop Editors, Docs test examples
When working with office files, the font plays a big role in creating an optimal user experience. This article will walk you through the steps to customize the default font in ONLYOFFICE DocSpace, desktop app, and test examples for Docs to meet your needs and get more control over your document styling.
Changing the default font in ONLYOFFICE DocSpace Server
By default, when you create new blank documents in DocSpace, the font is set to Arial, 11 pt for DOCX files and PDF forms, and Calibri, 11 pt for spreadsheets. For PPTX files, Arial is the default font used in text boxes and placeholders like titles, subtitles, etc.
To modify the default font for all new documents, you need to replace the template files that DocSpace uses: new.docx, new.pdf, new.xlsx, new.pptx.
Below, you can find the commands for the DocSpace Docker version.
- Enter the container where the template files are stored:
sudo docker exec -it onlyoffice-files bash
- Locate the template folder:
cd /var/www/products/ASC.Files/server/DocStore/new
- List files by locale:
ls
For example, en-US
represents the default templates for English (United States).
- Exit the container:
exit
- Copy the original locale folder (e.g.,
en-US
) from the container to your host machine:
sudo docker cp onlyoffice-files:/var/www/products/ASC.Files/server/DocStore/new/en-US /root/en-US
- Open the copied files in ONLYOFFICE Desktop Editors. Customize the font, size, or other settings as needed, and save the changes.
- Copy the edited files back to the container:
sudo docker cp /root/en-US/. onlyoffice-files:/var/www/products/ASC.Files/server/DocStore/new/en-US
Once ready, all new documents will use the specified font if the DocSpace language is set to en-US
. For other languages, update and replace the template files for each locale.
File path for other installations
For the Debian/Ubuntu and RPM-based systems, the empty templates are located at:
/var/www/docspace/products/ASC.Files/server/DocStore/new/
For the Windows version, the file templates are stored at:
C:\Program Files (x86)\Ascensio System SIA\DocSpace\products\ASC.Files\DocStore\new
Changing the default font in ONLYOFFICE Desktop Editors
ONLYOFFICE Desktop Editors also allow you to adjust the default font, size, styles, margins, and other settings for new documents, spreadsheets, presentations, and PDF forms. This is done by replacing the default templates.
1. Locate the default templates folder
The path to the folder depends on your operating system:
- macOS:
/Applications/ONLYOFFICE.app/Contents/Resources/converter/empty/
- Linux:
/opt/onlyoffice/desktopeditors/converter/empty/
- Windows (64-bit):
%ProgramFiles%\ONLYOFFICE\DesktopEditors\converter\empty
2. Copy templates to a new location
Open the locale folder corresponding to your interface language and copy the new.docx, new.xlsx, new.pptx, and new.pdf files to another directory as a backup.
3. Edit the templates
Open the files in ONLYOFFICE Desktop Editors. Adjust the font, sizes, and other styles. Save the modified files.
4. Replace default templates
Copy the edited templates back to the original folder to overwrite the default ones.
Please note: when you update ONLYOFFICE Desktop Editors, custom templates may be replaced with default templates from the new version. To avoid this, keep backups of your customized templates and replace them again after updating.
Changing the default font in the ONLYOFFICE Docs test examples
For developers using the ONLYOFFICE Docs test examples, changing the default font requires updating the predefined document templates within the project’s assets.
1. Locate the templates folder
Depending on your programming language, templates are stored in the following paths:
- .NET (C# / C# MVC):
assets/document-templates/new
- Go:
static/assets/document-templates/new
- Java / Java Spring:
src/main/resources/assets/document-templates/new
- Node.js:
public/assets/document-templates/new
- Python:
assets/document-templates/new
- Ruby:
assets/document-templates/new
- PHP:
assets/document-templates/new
- PHP (Laravel):
public/assets/document-templates/new
2. Modify templates
Open the required file types (new.docx, new.xlsx, new.pptx, new.pdf) in ONLYOFFICE Desktop Editors. Adjust the font or any other settings, then save the files.
3. Save the modified templates
Replace the existing templates in the project folder with the modified ones.
After these changes, all new documents created within the test environment will use the updated font settings.
Useful tip for all solutions
Remember to always backup default templates before making changes so you can restore them if necessary.
Create your free ONLYOFFICE account
View, edit and collaborate on docs, sheets, slides, forms, and PDF files online.