Reputation: 1
When the file is empty, the default font style is Arial, and the font size is 11.
I want to change the default font size to 16
Where can I modify the source code?
I expect that when the file is empty, the default font size and font style can be configured by myself, rather than the Arial provided by onlyOffice.
Upvotes: 0
Views: 782
Reputation: 387
One way to do this, without setting up more tools other than a plain text editor and zip program, is to directly edit the styles.xml file, which is a component part of most open xml documents, in this case an .xlsx file. This method results in reindex fontId="0" Caveat! this is a hack with limited testing.
To avoid typing errors later, open a new workbook, enter a word in a cell, then adjust that cell's font to the target font you want to use as your custom default, save the new workbook as source.xlsx, then close it.
The next few steps we will refer to as the process. Reopen source.xlsx with your favorite zip program, like winrar, enter the 'xl' directory, extract styles.xml, rename it source.xml.
Assuming we want all subsequently 'new' workbooks to have a non-default font and/or size, we'll edit styles in new.xlsx, the template used to create new workbooks.
Find <install folder>/ONLYOFFICE/DesktopEditors/converter/empty/<lang>/new.xlsx
. Suggestion: rename new.xlsx -> new.orig.xlsx, copy new.orig.xlsx -> new.xlsx. Conduct the process on new.xlsx (the copy), except in the final step, rename styles.xml to styles.new.xml.
Now, with your plain text editor like notepad++, open both your renamed .xml files, and locate the <fonts...>
block in each xml file. Select and copy the <font>...</font>
entry in the source.xml that refers to your 'new' default font.
<font><sz val="14.000000"/><color theme="1"/><name val="Arial"/></font>
Switch to your styles.new.xml, find the opening <fonts count="x">
entry, paste the above copied <font>...</font>
entry immediately following the opening <fonts...>
entry.
<fonts count="x"><font><sz val="14.000000"/><color theme="1"/><name val="Arial"/></font>
Save styles.new.xml, add it to the zipped archive named new.xlsx. Within the archive, rename styles.xml -> styles.orig.xml, and styles.new.xml -> styles.xml, close and save new.xlsx archive.
Open a new workbook and confirm your 'new' default font is active. Add a word to a cell, and check its font and size.
The process for an already existing workbook is similar to the above, but results in reindexing fonts, 1 becomes 2 etc., and replaces fontId="0" used by 'Normal' stype. Reindexing may lead to unfavorable changes to formats.
Make a copy of your workbook, then extract, edit, and overwrite styles.xml in the workbook archive. Open the workbook and apply your custom default to existing content using the 'Normal' style button. Beware! preexisting content is not automatically updated, and will be falsely reported as already at the custom default, but won't be until the custom default is applied by you. Content entered in previously empty cells, correctly reports and assumes the custom default.
Be glad you don't have to do this very often. If you do, investigate tools like ONLYOFFICE Document Builder. Final suggestion: if you edited new.xlsx, back it up outside of the install directory, which is certain to be overwritten by updates.
Upvotes: 0
Reputation: 46
When you integrate Document Server with your own application, the Document Server doesn't create files in this sceanario itself, it merely uses the ones you specify. Specifically, you pass this url https://api.onlyoffice.com/editors/config/document#url in the editor configuration with the desired file to be opened for editing. Thus, you need to set the corresponding settings in this file prior to opening it with Document Server. In this case, it will be opened for editing with the required font and style.
Upvotes: 0