"block" Formatting Object Examples

This section provides a tutorial example on how to use 'block' formatting object with some basic attributes.

In my first example of "block" formatting objects, block-Formatting-Objects.fo, I am showing two "block" elements with some basic attributes:

<?xml version="1.1" encoding="utf-8"?>
<!-- block-Formatting-Objects.fo
 - Copyright (c) 2016, HerongYang.com, All Rights Reserved.
<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
  <fo:simple-page-master master-name="page" 
   margin="0.1in" page-height="2in" page-width="3in">
   <fo:region-body region-name="body" background-color="#eeeeee"/>
 <fo:page-sequence master-reference="page">
  <fo:flow flow-name="body">
   <fo:block margin="0.1in" padding="0.2in"
    border-width="1px" border-style="solid" 
    background-color="#eeffff" color="#000000" 
    text-align="justify" font-family="sans-serif">
    There was once upon a time a pig who lived with her three children
    on a large, comfortable, old-fashioned farmyard.
   <fo:block border-width="1px" border-style="solid">

When you process the above sample XSL-FO document to a PDF file and open it, you should see a page with 2 block areas:

"block" Formatting Object Examples

Note that:

Last update: 2016.

Table of Contents

 About This XSL-FO Tutorial Book

 Introduction of XSL-FO

 Apache™ FOP (Formatting Objects Processor)

 RenderX XEP as an XSL-FO Tool

 Introduction of Area Model

 XSL-FO Document Basics and Examples

 Page Layout Masters

Block-Level Formatting Objects

 What Are Block-Level Formatting Objects?

 What Is "block" Formatting Object?

"block" Formatting Object Examples

 Margin Collapsed between Block Areas

 space-before/space-after vs. Margin

 Block Splitting for Page Break

 "block" with Mixed Content

 Controlling White Space Characters

 What Is "block-container" Formatting Object?

 Inline-Level Formatting Objects

 Including Graphics in XSL-FO document

 Table of Rows and Columns

 List, Item, Label, and Body

 Floating Blocks - "float" and "footnote"

 Hyperlinks, Table of Contents and Indexes

 Headers and Footers using "static-content"

 Font Attributes and Font Families

 Apache FOP Font Configurations

 RenderX XEP Font Configurations


 PDF Printing Version