Grid (lines and spacing)

From Apache OpenOffice Wiki
Jump to: navigation, search


  • Last update: March 4, 2008 by tora

Parent project

This project is a part of the parent project jsdp2007.


This project includes the following sub-projects:


This project aims at solving one of the Asian specific problems with Writer, especially interoperability with Microsoft Word.

When Writer loads a Word file with a choice of 'Specify line and character grid' in the Page Setup dialog, its text layout gets greatly broken.

Facts Expectations
Grid lines and spacing 0001.png Grid lines and spacing 0002.png

The picture of Facts is taken with pure 2.3 while the picture of expectations is taken with plus accomplishments of this project.

Sample files


Word has four choices for grid layout while Writer has three.

Word Writer
Grid lines and spacing 0011.png Grid lines and spacing 0012.png

The current mapping among choices upon loading a Word file:

Choice of Word Choice of Writer
No grid No grid
Specify line grid only Grid (lines only)
Specify line and character grid Grid (lines and characters)
Text snaps to character grid Grid (lines and characters)

Writer's Grid (lines and characters) differs from Word's Specify line and character gid, though. The lack of this choice in Writer brings the problem.


To solve the problem, we have tried to add the fourth choice to Writer. The new choice is preliminarily named 'Grid (lines and character spacing)' or, shortly, 'Grid (lines and spacing).'

New choice in Writer
Grid lines and spacing 0021.png

With addition of the new choice, an import filter has been enhanced to recognize it as below.

Choice of Word Choice of Writer
No grid No grid
Specify line grid only Grid (lines only)
Specify line and character grid Grid (lines and character spacing)
Text snaps to character grid Grid (lines and characters)

How it works

The fourth grid type 'Grid (lines and spacing)' manages the amount of room between side-by-side characters. The amount of room, called Character space, is determined by an equation, subtracting the value of Standard font size from the value of 'Max. base text size.' The Standard font size equals to the size of Asian text font for the Paragraph style 'Default.'

No grid - for reference
Grid lines and spacing 0031.png
Grid lines and spacing 0032.png

Grid (lines and character spacing) - Scaled Condensed
Grid lines and spacing 0041.png
Grid lines and spacing 0042.png

Grid (lines and character spacing) - Expanded
Grid lines and spacing 0051.png
Grid lines and spacing 0052.png

File format

This attempt of adding a new type of grid layout will need to propose an enhancement to the OpenDoucment File format.

A new keyword 'spacing' for the new layout "Grid (lines and character spacing)" is experimentally added to the element 'style:layout-grid-mode' defined in the section 15.2.21 Layout Grid of "Open Document Format for Office Applications (OpenDocument) v1.1" [1]


Three texts have been added to the tab page 'Text Grid'

  • Grid (lines and character spacing)
  • Standard font size
  • Character space


The following modules have been modified.

Module Modifications
  • Adding some controls to the tab page 'Text Grid'
  • Enhancing a way of formatting text layout
  • Adding a new choice to ww8 import and export filters
svx Adding a helper class for a combination of FixedText and NumericFormatter
offapi Adding a new choice to com::sun::star::text::TextGridMode
xmloff Adding a new token 'spacing'

Online help

No text has been added to the online help.


Personal tools