Open Document Format for Office Applications (OpenDocument) v1.0 (Second Edition)

Committee Specification1, 19 Jul 2006

Document identifier:

OpenDocument-v1.0ed2-cs1.odt

Location:

This Version: http://www.oasis-open.org/committees/office
Previous Version: http://docs.oasis-open.org/office/v1.0

Editors:

Patrick Durusau, Individual

Michael Brauer, Sun Microsystems, Inc.

Abstract:

This is the specification of the Open Document Format for Office Applications (OpenDocument) format, an open, XML-based file format for office applications, based on OpenOffice.org XML [OOo].

Status:

This document was last revised or approved by the OASIS Open Document Format for Office Applications (OpenDocument) Technical Committee on the above date. The level of approval is also listed above. Check the current location noted above for possible later revisions of this document. This document is updated periodically on no particular schedule.

Technical Committee members should send comments on this specification to the Technical Committee's email list. Others should send comments to the Technical Committee by using the "Send A Comment" button on the Technical Committee's web page at

www.oasis-open.org/committees/office.

For information on whether any patents have been disclosed that may be essential to implementing this specification, and any offers of patent licensing terms, please refer to the Intellectual Property Rights section of the Technical Committee web page

(www.oasis-open.org/committees/office/ipr.php.

The non-normative errata page for this specification is located at www.oasis-open.org/committees/office.

Table of Contents

1 Introduction 30

1.1 Introduction 30

1.2 Notation 30

1.3 Namespaces 30

1.4 Relax-NG Schema 32

1.5 Document Processing and Conformance 33

1.6 White-Space Processing and EOL Handling 34

1.7 MIME Types and File Name Extensions 34

2 Document Structure 35

2.1 Document Roots 35

2.1.1 Document Root Element Content Models 36

2.1.2 Document Root Attributes 37

2.2 Document Metadata 38

2.2.1 Pre-Defined vs. Custom Metadata 38

2.2.2 Sample Metadata 38

2.3 Body Element and Document Types 39

2.3.1 Text Documents 39

2.3.2 Drawing Documents 41

2.3.3 Presentation Documents 42

2.3.4 Spreadsheet Documents 42

2.3.5 Chart Documents 44

2.3.6 Image Documents 44

2.4 Application Settings 45

2.4.1 Sequence of Settings 45

2.4.2 Base Settings 46

2.4.3 Index Access of Sequences 47

2.4.4 Map Entry 47

2.4.5 Name Access of Sequences 47

2.4.6 Cursor Position Setting 48

2.5 Scripts 48

2.5.1 Script 49

2.6 Font Face Declarations 49

2.7 Styles 49

2.7.1 Location of Styles 50

2.8 Page Styles and Layout 52

3 Meta Data Elements 54

3.1 Pre-Defined Metadata Elements 54

3.1.1 Generator 54

3.1.2 Title 54

3.1.3 Description 54

3.1.4 Subject 55

3.1.5 Keywords 55

3.1.6 Initial Creator 55

3.1.7 Creator 55

3.1.8 Printed By 55

3.1.9 Creation Date and Time 56

3.1.10 Modification Date and Time 56

3.1.11 Print Date and Time 56

3.1.12 Document Template 56

3.1.13 Automatic Reload 57

3.1.14 Hyperlink Behavior 58

3.1.15 Language 59

3.1.16 Editing Cycles 59

3.1.17 Editing Duration 59

3.1.18 Document Statistics 60

3.2 User-defined Metadata 62

3.3 Custom Metadata 63

4 Text Content 64

4.1 Headings, Paragraphs and Basic Text Structure 64

4.1.1 Headings 64

4.1.2 Paragraphs 65

4.1.3 Common Paragraph Elements Attributes 65

4.2 Page Sequences 66

4.2.1 Page 67

4.3 Lists 68

4.3.1 List Block 68

4.3.2 List Item 69

4.3.3 List Header 70

4.3.4 Numbered Paragraphs 71

4.4 Text Sections 71

4.4.1 Section Attributes 72

4.4.2 Section Source 74

4.4.3 DDE Source 75

4.5 Page-bound graphical content 75

4.6 Change Tracking 75

4.6.1 Tracked Changes 75

4.6.2 Changed Regions 76

4.6.3 Insertion 76

4.6.4 Deletion 77

4.6.5 Format Change 79

4.6.6 Change Info 79

4.6.7 Change Marks 79

4.7 Text Declarations 80

5 Paragraph Elements Content 81

5.1 Basic Text Content 81

5.1.1 White-space Characters 81

5.1.2 Soft Hyphens, Hyphens, and Non-breaking Blanks 83

5.1.3 Attributed Text 83

5.1.4 Hyperlinks 84

5.2 Bookmarks and References 86

5.2.1 Bookmarks 86

5.2.2 References 87

5.3 Notes 88

5.3.1 Note Element 88

5.4 Ruby 90

5.5 Text Annotation 91

5.6 Index Marks 91

5.7 Change Tracking and Change Marks 91

5.8 Inline graphics and text-boxes 91

6 Text Fields 92

6.1 Common Characteristics of Field Elements 92

6.2 Document Fields 93

6.2.1 Date Fields 93

6.2.2 Time Fields 94

6.2.3 Page Number Fields 96

6.2.4 Page Continuation Text 97

6.2.5 Sender Fields 98

6.2.6 Author Fields 100

6.2.7 Chapter Fields 101

6.2.8 File Name Fields 102

6.2.9 Document Template Name Fields 103

6.2.10 Sheet Name Fields 104

6.3 Variable Fields 104

6.3.1 Declaring Simple Variables 105

6.3.2 Setting Simple Variables 105

6.3.3 Displaying Simple Variables 106

6.3.4 Simple Variable Input Fields 107

6.3.5 Declaring User Variables 107

6.3.6 Displaying User Variables 108

6.3.7 User Variable Input Fields 109

6.3.8 Declaring Sequence Variables 109

6.3.9 Using Sequence Fields 111

6.3.10 Expression Fields 112

6.3.11 Text Input Fields 112

6.4 Metadata Fields 113

6.4.1 Initial Creator 113

6.4.2 Document Creation Date 113

6.4.3 Document Creation Time 114

6.4.4 Document Description 114

6.4.5 User-Defined Document Information 114

6.4.6 Print Time 115

6.4.7 Print Date 115

6.4.8 Printed By 115

6.4.9 Document Title 116

6.4.10 Document Subject 116

6.4.11 Document Keywords 116

6.4.12 Document Revision Number 116

6.4.13 Document Edit Duration 116

6.4.14 Document Modification Time 117

6.4.15 Document Modification Date 117

6.4.16 Document Modified By 117

6.4.17 Document Statistics Fields 118

6.5 Database Fields 118

6.5.1 Database Field Data Source 119

6.5.2 Displaying Database Content 120

6.5.3 Selecting the Next Database Row 121

6.5.4 Selecting a Row Number 122

6.5.5 Displaying the Row Number 122

6.5.6 Display Current Database and Table 123

6.6 More Fields 123

6.6.1 Page Variable Fields 123

6.6.2 Placeholders 124

6.6.3 Conditional Text Fields 125

6.6.4 Hidden Text Field 127

6.6.5 Reference Fields 128

6.6.6 Script Fields 130

6.6.7 Macro Fields 131

6.6.8 Hidden Paragraph Fields 131

6.6.9 DDE Connection Fields 132

6.6.10 Measure Fields 133

6.6.11 Table Formula Field 133

6.7 Common Field Attributes 134

6.7.1 Variable Value Types and Values 134

6.7.2 Fixed 136

6.7.3 Variable Name 136

6.7.4 Description 137

6.7.5 Display 137

6.7.6 Formula 138

6.7.7 Formatting Style 139

6.7.8 Number Formatting Style 139

7 Text Indices 141

7.1 Index Marks 141

7.1.1 Table of Content Index Marks 141

7.1.2 User-Defined Index Marks 142

7.1.3 Alphabetical Index Mark 143

7.1.4 Bibliography Index Mark 145

7.2 Index Structure 146

7.2.1 Index Source 146

7.2.2 Index Body Section 147

7.2.3 Index Title Section 147

7.3 Table Of Content 147

7.3.1 Table of Content Source 148

7.3.2 Table of Content Entry Template 150

7.4 Index of Illustrations 151

7.4.1 Index of Illustration Source 151

7.4.2 Illustration Index Entry Template 153

7.5 Index of Tables 154

7.5.1 Table Index Source 154

7.5.2 Table Index Entry Template 154

7.6 Index of Objects 155

7.6.1 Object Index Source 155

7.6.2 Object Index Entry Template 156

7.7 User-Defined Index 156

7.7.1 User-Defined Index Source 157

7.7.2 User-Defined Index Entry Template 159

7.8 Alphabetical Index 159

7.8.1 Alphabetical Index Source 160

7.8.2 Auto Mark File 163

7.8.3 Alphabetical Index Entry Template 164

7.9 Bibliography 165

7.9.1 Bibliography Index Source 165

7.9.2 Bibliography Entry Template 165

7.10 index source styles 166

7.10.1 Index source style 166

7.11 Index title template 166

7.12 Index Template Entries 167

7.12.1 Chapter Information 167

7.12.2 Entry Text 167

7.12.3 Page Number 168

7.12.4 Fixed String 168

7.12.5 Bibliography Information 168

7.12.6 Tab Stop 170

7.12.7 Hyperlink Start and End 171

7.12.8 Example of an Index Entry Configuration 171

8 Tables 173

8.1 Basic Table Model 173

8.1.1 Table Element 173

8.1.2 Table Row 176

8.1.3 Table Cell 178

8.2 Advanced Table Model 183

8.2.1 Column Description 183

8.2.2 Header Columns 185

8.2.3 Column Groups 186

8.2.4 Header Rows 186

8.2.5 Row Groups 187

8.2.6 Subtables 187

8.3 Advanced Tables 191

8.3.1 Referencing Table Cells 191

8.3.2 Linked Tables 192

8.3.3 Scenario Tables 194

8.3.4 Shapes 197

8.4 Advanced Table Cells 197

8.4.1 Linked Table Cells 197

8.4.2 Cell Annotation 198

8.4.3 Detective 198

8.4.4 Detective Operation 198

8.4.5 Highlighted Range 199

8.5 Spreadsheet Document Content 201

8.5.1 Document Protection 201

8.5.2 Calculation Settings 201

8.5.3 Table Cell Content Validations 204

8.5.4 Label Ranges 208

8.5.5 Named Expressions 209

8.6 Database Ranges 211

8.6.1 Database Range 211

8.6.2 Database Source SQL 214

8.6.3 Database Source Table 215

8.6.4 Database Source Query 216

8.6.5 Sort 216

8.6.6 Sort By 218

8.6.7 Subtotal Rules 219

8.6.8 Subtotal Sort Groups 220

8.6.9 Subtotal Rule 220

8.6.10 Subtotal Field 221

8.7 Filters 222

8.7.1 Table Filter 222

8.7.2 Filter And 224

8.7.3 Filter Or 224

8.7.4 Filter Condition 224

8.8 Data Pilot Tables 226

8.8.1 Data Pilot Table 226

8.8.2 Source Cell Range 231

8.8.3 Source Service 231

8.8.4 Data Pilot Field 233

8.8.5 Data Pilot Level 235

8.8.6 Data Pilot Subtotals 236

8.8.7 Data Pilot Subtotal 236

8.8.8 Data Pilot Members 237

8.8.9 Data Pilot Member 237

8.8.10 Data Pilot Display Info 238

8.8.11 Data Pilot Sort Info 239

8.8.12 Data Pilot Layout Info 240

8.8.13 Data Pilot Field Reference 241

8.8.14 Data Pilot Groups 242

8.8.15 Data Pilot Group 244

8.8.16 Data Pilot Group Member 245

8.9 Consolidation 245

8.10 DDE Links 247

8.11 Change Tracking in Spreadsheets 247

8.11.1 Tracked Changes 247

8.11.2 Insertion 248

8.11.3 Dependencies 249

8.11.4 Dependence 250

8.11.5 Deletions 250

8.11.6 Cell Content Deletion 250

8.11.7 Change Deletion 250

8.11.8 Deletion 251

8.11.9 Cut Offs 252

8.11.10 Insertion Cut Off 253

8.11.11 Movement Cut Off 253

8.11.12 Movement 254

8.11.13 Target Range Address, Source Range Address 255

8.11.14 Change Track Cell 256

8.11.15 Cell Content Change 257

8.11.16 Cell Address 258

8.11.17 Previous 258

8.11.18 Common Change Tracking Attributes 258

9 Graphic Content 260

9.1 Enhanced Page Features for Graphical Applications 260

9.1.1 Handout Master 260

9.1.2 Layer Sets 261

9.1.3 Layer 262

9.1.4 Drawing Pages 262

9.1.5 Presentation Notes 265

9.2 Drawing Shapes 266

9.2.1 Rectangle 266

9.2.2 Line 267

9.2.3 Polyline 268

9.2.4 Polygon 269

9.2.5 Regular Polygon 269

9.2.6 Path 271

9.2.7 Circle 272

9.2.8 Ellipse 273

9.2.9 Connector 274

9.2.10 Caption 277

9.2.11 Measure 278

9.2.12 Control 279

9.2.13 Page Thumbnail 280

9.2.14 Grouping 280

9.2.15 Common Drawing Shape Attributes 281

9.2.16 Common Shape Attributes for Text and Spreadsheet Documents 285

9.2.17 Common Drawing Shape Content 287

9.2.18 Common Shape Attribute Groups 287

9.2.19 Glue Points 287

9.2.20 Event Listeners 289

9.3 Frames 289

9.3.1 Text Box 292

9.3.2 Image 294

9.3.3 Objects 295

9.3.4 Applet 297

9.3.5 Plugins 299

9.3.6 Parameters 299

9.3.7 Floating Frame 300

9.3.8 Contour 301

9.3.9 Alternative Text 301

9.3.10 Hyperlinks 302

9.3.11 Client Side Image Maps 304

9.4 3D Shapes 308

9.4.1 Scene 308

9.4.2 Light 311

9.4.3 Cube 312

9.4.4 Sphere 313

9.4.5 Extrude 314

9.4.6 Rotate 314

9.5 Custom Shape 315

9.5.1 Enhanced Geometry 316

9.5.2 Enhanced Geometry - Extrusion Attributes 318

9.5.3 Enhanced Geometry - Path Attributes 324

9.5.4 Enhanced Geometry - Text Path Attributes 328

9.5.5 Enhanced Geometry – Equation 330

9.5.6 Enhanced Geometry - Handle Attributes 331

9.6 Presentation Shapes 335

9.6.1 Common Presentation Shape Attributes 335

9.7 Presentation Animations 337

9.7.1 Sound 338

9.7.2 Show Shape 339

9.7.3 Show Text 342

9.7.4 Hide Shape 342

9.7.5 Hide Text 343

9.7.6 Dim 343

9.7.7 Play 343

9.7.8 Effect groups 344

9.8 SMIL Presentation Animations 344

9.8.1 Recommended Usage Of SMIL 344

9.8.2 Document Dependent SMIL Animation Attribute Values 346

9.8.3 SMIL Presentation Animation Attributes 348

9.9 Presentation Events 350

9.10 Presentation Text Fields 353

9.10.1 Header Field 353

9.10.2 Footer Field 354

9.10.3 Date and Time Field 354

9.11 Presentation Document Content 354

9.11.1 Presentation Declarations 354

9.11.2 Header field declaration 354

9.11.3 Footer field declaration 355

9.11.4 Date and Time field declaration 355

9.11.5 Presentation Settings 356

9.11.6 Show Definitions 360

10 Chart Content 361

10.1 Introduction to Chart Documents 361

10.2 Chart 361

10.3 Title, Subtitle and Footer 365

10.3.1 Title 365

10.3.2 Subtitle 366

10.3.3 Footer 366

10.4 Legend 366

10.5 Plot Area 368

10.5.1 3D Plot Area 370

10.6 Wall 370

10.7 Floor 371

10.8 Axis 371

10.8.1 Grid 373

10.9 Series 374

10.9.1 Domain 375

10.10 Categories 376

10.11 Data Point 376

10.12 Mean Value 377

10.13 Error Indicator 377

10.14 Regression Curves 378

10.14.1 Stock Chart Markers 378

11 Form Content 380

11.1 Form 381

11.1.1 Action 382

11.1.2 Target Frame 382

11.1.3 Method 383

11.1.4 Encoding Type 383

11.1.5 Allow Deletes 383

11.1.6 Allow Inserts 384

11.1.7 Allow Updates 384

11.1.8 Apply Filter 384

11.1.9 Command Type 384

11.1.10 Command 385

11.1.11 Data Source 385

11.1.12 Master Fields 385

11.1.13 Detail Fields 385

11.1.14 Escape Processing 386

11.1.15 Filter 386

11.1.16 Ignore Result 386

11.1.17 Navigation Mode 386

11.1.18 Order 387

11.1.19 Tabbing Cycle 387

11.1.20 Connection Resource 388

11.2 XForms Model 388

11.2.1 XForms Model 388

11.3 Controls 388

11.3.1 Text 389

11.3.2 Text Area 390

11.3.3 Password 391

11.3.4 File 392

11.3.5 Formatted Text 392

11.3.6 Number 393

11.3.7 Date And Time 395

11.3.8 Fixed Text 396

11.3.9 Combo Box 397

11.3.10 List Box 398

11.3.11 Button 400

11.3.12 Image 401

11.3.13 Check Box 402

11.3.14 Radio Button 403

11.3.15 Frame 404

11.3.16 Image Frame 404

11.3.17 Hidden 405

11.3.18 Grid 405

11.3.19 Value Range 406

11.3.20 Generic Control 408

11.4 Common Form and Control Attributes 409

11.4.1 Name 409

11.4.2 Control Implementation 409

11.4.3 Bind to XForms 409

11.5 Common Control Attributes 410

11.5.1 Button Type 410

11.5.2 Control ID 410

11.5.3 Current Selected 411

11.5.4 Value and Current Value 411

11.5.5 Disabled 413

11.5.6 Dropdown 413

11.5.7 For 414

11.5.8 Image Data 414

11.5.9 Label 414

11.5.10 Maximum Length 415

11.5.11 Printable 415

11.5.12 Read only 416

11.5.13 Selected 416

11.5.14 Size 417

11.5.15 Tab Index 417

11.5.16 Tab Stop 418

11.5.17 Target Frame 418

11.5.18 Target Location 419

11.5.19 Title 419

11.5.20 Visual Effect 420

11.5.21 Relative Image Position 420

11.5.22 Database Binding Attributes 421

11.6 Events 423

11.6.1 Events with an Equivalent HTML Event Type 423

11.6.2 Event Types 424

11.7 Properties 426

11.7.1 Property Set 426

11.7.2 Property 426

11.7.3 List Property 427

12 Common Content 430

12.1 Annotation 430

12.1.1 Creator 431

12.1.2 Creation Date and Time 431

12.1.3 Creation Date and Time String 431

12.2 Number Format 431

12.2.1 Prefix and Suffix 431

12.2.2 Format Specification 432

12.2.3 Letter Synchronization in Number Formats 432

12.3 Change Tracking Metadata 433

12.4 Event Listener Tables 433

12.4.1 Event Listener 434

12.5 Mathematical Content 435

12.6 DDE Connections 436

12.6.1 Container for DDE Connection Declarations 436

12.6.2 Declaring DDE Connections for Text Fields 436

12.6.3 Declaring DDE Connections for Tables 437

13 SMIL Animations 440

13.1 Basic Animation Elements 440

13.1.1 Animate 440

13.1.2 Set 440

13.1.3 Animate Motion 440

13.1.4 Animate Color 441

13.1.5 Animate Transform 442

13.1.6 Transition Filter 443

13.2 Animation Model Attributes 444

13.3 Common Animation Attributes 444

13.3.1 Animation Target Attributes 445

13.3.2 Animation Function Attributes 445

13.4 Animation Timing 448

13.4.1 Animation Timing Attributes 448

13.4.2 Parallel Animations 451

13.4.3 Sequential Animations 452

13.4.4 Iterative Animations 452

13.5 Media Elements 453

13.5.1 Audio 453

13.6 Special Elements 454

13.6.1 Command 454

14 Styles 455

14.1 Style Element 455

14.1.1 Style Mappings 459

14.2 Default Styles 461

14.3 Page Layout 461

14.3.1 Header and Footer Styles 462

14.4 Master Pages 463

14.4.1 Headers and Footers 465

14.4.2 Presentation Notes 467

14.5 Table Templates 468

14.5.1 Row and Column Styles 470

14.6 Font Face Declaration 471

14.6.1 CSS2/SVG Font Descriptors 472

14.6.2 Name 475

14.6.3 Adornments 476

14.6.4 Font Family Generic 476

14.6.5 Font Pitch 476

14.6.6 Font Character Set 476

14.7 Data Styles 476

14.7.1 Number Style 477

14.7.2 Currency Style 480

14.7.3 Percentage Style 482

14.7.4 Date Style 483

14.7.5 Time Style 488

14.7.6 Boolean Style 492

14.7.7 Text Style 492

14.7.8 Common Data Style Elements 493

14.7.9 Common Data Style Attributes 494

14.7.10 Transliteration 496

14.7.11 Common Data Style Child Element Attributes 498

14.8 Text Styles 500

14.8.1 Text Styles 500

14.8.2 Paragraph Styles 500

14.8.3 Section Styles 500

14.8.4 Ruby Style 501

14.9 Enhanced Text Styles 501

14.9.1 Line Numbering Configuration 501

14.9.2 Notes Configuration Element 504

14.9.3 Bibliography Configuration 507

14.10 List Style 510

14.10.1 Common List-Level Style Attributes 511

14.10.2 Number Level Style 511

14.10.3 Bullet Level Style 512

14.10.4 Image Level Style 514

14.10.5 List Level Style Example 515

14.11 Outline Style 515

14.11.1 Outline Level Style 516

14.12 Table Styles 517

14.12.1 Table Styles 517

14.12.2 Table Column Styles 517

14.12.3 Table Row Styles 518

14.12.4 Table Cell Styles 518

14.13 Graphic Styles 518

14.13.1 Graphic and Presentation Styles 518

14.13.2 Drawing Page Style 519

14.14 Enhanced Graphic Style Elements 520

14.14.1 Gradient 520

14.14.2 SVG Gradients 523

14.14.3 Hatch 526

14.14.4 Fill Image 527

14.14.5 Opacity Gradient 529

14.14.6 Marker 530

14.14.7 Stroke Dash 530

14.15 Presentation Page Layouts 532

14.15.1 Presentation Placeholder 532

14.16 Chart Styles 533

15 Formatting Properties 534

15.1 Simple and Complex Formatting Properties 534

15.1.1 Simple Formatting Properties 534

15.1.2 Complex Formatting Properties 535

15.1.3 Processing Rules for Formatting Properties 535

15.2 Page Layout Formatting Properties 535

15.2.1 Page Size 536

15.2.2 Page Number Format 536

15.2.3 Paper Tray 537

15.2.4 Print Orientation 537

15.2.5 Margins 537

15.2.6 Border 538

15.2.7 Border Line Width 538

15.2.8 Padding 538

15.2.9 Shadow 538

15.2.10 Background 538

15.2.11 Columns 539

15.2.12 Register-truth 539

15.2.13 Print 539

15.2.14 Print Page Order 540

15.2.15 First Page Number 540

15.2.16 Scale 540

15.2.17 Table Centering 541

15.2.18 Maximum Footnote Height 541

15.2.19 Writing Mode 541

15.2.20 Footnote Separator 542

15.2.21 Layout Grid 543

15.2.22 Layout Grid Base Height 543

15.2.23 Layout Grid Ruby Height 544

15.2.24 Layout Grid Lines 544

15.2.25 Layout Grid Color 544

15.2.26 Layout Grid Ruby Below 544

15.2.27 Layout Grid Print 544

15.2.28 Layout Grid Display 545

15.3 Header Footer Formatting Properties 545

15.3.1 Fixed and Minimum heights 545

15.3.2 Margins 546

15.3.3 Border 546

15.3.4 Border Line Width 546

15.3.5 Padding 546

15.3.6 Background 547

15.3.7 Shadow 547

15.3.8 Dynamic Spacing 547

15.4 Text Formatting Properties 547

15.4.1 Font Variant 548

15.4.2 Text Transformations 548

15.4.3 Color 548

15.4.4 Window Font Color 549

15.4.5 Text Outline 549

15.4.6 Line-Through Type 549

15.4.7 Line-Through Style 549

15.4.8 Line-Through Width 549

15.4.9 Line-Through Color 550

15.4.10 Line-Through Text 550

15.4.11 Line-Through Text Style 550

15.4.12 Text Position 551

15.4.13 Font Name 551

15.4.14 Font Family 552

15.4.15 Font Family Generic 552

15.4.16 Font Style 553

15.4.17 Font Pitch 553

15.4.18 Font Character Set 554

15.4.19 Font Size 555

15.4.20 Relative Font Size 555

15.4.21 Script Type 556

15.4.22 Letter Spacing 556

15.4.23 Language 557

15.4.24 Country 557

15.4.25 Font Style 558

15.4.26 Font Relief 558

15.4.27 Text Shadow 558

15.4.28 Underlining Type 559

15.4.29 Underlining Style 559

15.4.30 Underling Width 560

15.4.31 Underline Color 560

15.4.32 Font Weight 560

15.4.33 Text Underline Word Mode 561

15.4.34 Text Line-Through Word Mode 561

15.4.35 Letter Kerning 562

15.4.36 Text Blinking 562

15.4.37 Text Background Color 562

15.4.38 Text Combine 562

15.4.39 Text Combine Start and End Characters 563

15.4.40 Text Emphasis 563

15.4.41 Text Scale 564

15.4.42 Text Rotation Angle 564

15.4.43 Text Rotation Scale 564

15.4.44 Hyphenation 564

15.4.45 Hyphenation Remain Char Count 565

15.4.46 Hyphenation Push Char Count 565

15.4.47 Hidden or Conditional Text 565

15.5 Paragraph Formatting Properties 566

15.5.1 Fixed Line Height 566

15.5.2 Minimum Line Height 566

15.5.3 Line Distance 567

15.5.4 Font-Independent Line Spacing 567

15.5.5 Text Align 567

15.5.6 Text Align of Last Line 568

15.5.7 Justify Single Word 568

15.5.8 Keep Together 568

15.5.9 Widows 569

15.5.10 Orphans 569

15.5.11 Tab Stops 569

15.5.12 Tab Stop Distance 572

15.5.13 Hyphenation Keep 572

15.5.14 Maximum Hyphens 573

15.5.15 Drop Caps 573

15.5.16 Register True 574

15.5.17 Left and Right Margins 575

15.5.18 Text Indent 575

15.5.19 Automatic Text Indent 576

15.5.20 Top and Bottom Margins 576

15.5.21 Margins 576

15.5.22 Break Before and Break After 577

15.5.23 Paragraph Background Color 577

15.5.24 Paragraph Background Image 578

15.5.25 Border 580

15.5.26 Border Line Width 581

15.5.27 Padding 582

15.5.28 Shadow 582

15.5.29 Keep with Next 583

15.5.30 Line Numbering 583

15.5.31 Line Number Start Value 583

15.5.32 Text Autospace 584

15.5.33 Punctuation Wrap 584

15.5.34 Line Break 584

15.5.35 Vertical Alignment 584

15.5.36 Writing Mode 585

15.5.37 Automatic Writing Mode 585

15.5.38 Snap To Layout 586

15.5.39 Page Number 586

15.5.40 Background Transparency 586

15.6 Ruby Text Formatting Properties 586

15.6.1 Ruby Position 587

15.6.2 Ruby Alignment 587

15.7 Section Formatting Properties 587

15.7.1 Section Background 588

15.7.2 Margins 588

15.7.3 Columns 588

15.7.4 Column Specification 589

15.7.5 Column Separator 590

15.7.6 Protect 592

15.7.7 Don't Balance Text Columns 592

15.7.8 Writing Mode 592

15.7.9 Notes Configuration 593

15.8 Table Formatting Properties 593

15.8.1 Table Width 593

15.8.2 Table Alignment 594

15.8.3 Table Left and Right Margin 594

15.8.4 Table Top and Bottom Margin 594

15.8.5 Table Margins 594

15.8.6 Page Number 595

15.8.7 Break Before and Break After 595

15.8.8 Table Background and Background Image 595

15.8.9 Table Shadow 595

15.8.10 Keep with Next 595

15.8.11 May Break Between Rows 595

15.8.12 Border Model Property 596

15.8.13 Writing Mode 596

15.8.14 Display 596

15.9 Column Formatting Properties 597

15.9.1 Column Width 597

15.9.2 Optimal Table Column Width 597

15.9.3 Break Before and Break After 598

15.10 Table Row Formatting Properties 598

15.10.1 Row Height 598

15.10.2 Optimal Table Row Height 598

15.10.3 Row Background 599

15.10.4 Break Before and Break After 599

15.10.5 Keep Together 599

15.11 Table Cell Formatting Properties 599

15.11.1 Vertical Alignment 600

15.11.2 Text Align Source 600

15.11.3 Direction 600

15.11.4 Vertical Glyph Orientation 601

15.11.5 Cell Shadow 601

15.11.6 Cell Background 601

15.11.7 Cell Border 601

15.11.8 Diagonal Lines 601

15.11.9 Border Line Width 602

15.11.10 Padding 602

15.11.11 Wrap Option 602

15.11.12 Rotation Angle 603

15.11.13 Rotation Align 603

15.11.14 Cell Protect 603

15.11.15 Print Content 604

15.11.16 Decimal places 604

15.11.17 Repeat Content 604

15.11.18 Shrink To Fit 605

15.12 List-Level Style Properties 605

15.13 Stroke Properties 607

15.13.1 Stroke Style 607

15.13.2 Dash 608

15.13.3 Multiple Dashes 608

15.13.4 Width 608

15.13.5 Color 608

15.13.6 Start Marker 609

15.13.7 End Marker 609

15.13.8 Start Marker Width 609

15.13.9 End Marker Width 609

15.13.10 Start Marker Center 609

15.13.11 End Marker Center 610

15.13.12 Opacity 610

15.13.13 Line Join 610

15.14 Fill Properties 610

15.14.1 Fill Style 611

15.14.2 Color 611

15.14.3 Secondary Fill Color 612

15.14.4 Gradient 612

15.14.5 Gradient Step Count 612

15.14.6 Hatch 612

15.14.7 Solid Hatch 613

15.14.8 Fill Image 613

15.14.9 Fill Image Rendering Style 613

15.14.10 Fill Image Size 613

15.14.11 Fill Image Tile Reference Point 614

15.14.12 Fill Image Tile Translation 614

15.14.13 None and Linear Opacity 615

15.14.14 Gradient Opacity 615

15.14.15 Fill Rule 615

15.14.16 Symbol color 616

15.15 Text Animation Properties 616

15.15.1 Animation 616

15.15.2 Animation Direction 617

15.15.3 Animation Start Inside 617

15.15.4 Animation Stop Inside 617

15.15.5 Animation Repeat 617

15.15.6 Animation Delay 617

15.15.7 Animation Steps 618

15.16 Text and Text Alignment Properties 618

15.16.1 Auto Grow Width and Height 618

15.16.2 Fit To Size 618

15.16.3 Fit To Contour 619

15.16.4 Text Area Vertical Align 619

15.16.5 Text Area Horizontal Align 619

15.16.6 Word Wrap 619

15.16.7 List Styles 620

15.17 Color Properties 620

15.17.1 Color Mode 620

15.17.2 Color Inversion 620

15.17.3 Adjust Luminance 621

15.17.4 Adjust Contrast 621

15.17.5 Adjust Gamma 621

15.17.6 Adjust Red 621

15.17.7 Adjust Green 621

15.17.8 Adjust Blue 622

15.17.9 Adjust Opacity 622

15.18 Shadow Properties 622

15.18.1 Shadow 622

15.18.2 Offset 622

15.18.3 Color 623

15.18.4 Opacity 623

15.19 Connector Properties 623

15.19.1 Start Line Spacing 623

15.19.2 End Line Spacing 624

15.20 Measure Properties 624

15.20.1 Line Distance 624

15.20.2 Guide Overhang 624

15.20.3 Guide Distance 624

15.20.4 Start Guide 625

15.20.5 End Guide 625

15.20.6 Placing 625

15.20.7 Parallel 625

15.20.8 Text Alignment 626

15.20.9 Unit 626

15.20.10 Show Unit 626

15.20.11 Decimal Places 627

15.21 Caption Properties 627

15.21.1 Type 627

15.21.2 Angle Type 628

15.21.3 Angle 628

15.21.4 Gap 628

15.21.5 Escape Direction 628

15.21.6 Escape 629

15.21.7 Line Length 629

15.21.8 Fit Line Length 629

15.22 3D Geometry Properties 629

15.22.1 Horizontal Segments 629

15.22.2 Vertical Segments 630

15.22.3 Edge Rounding 630

15.22.4 Edge Rounding Mode 630

15.22.5 Back Scale 630

15.22.6 Depth 631

15.22.7 Backface Culling 631

15.22.8 End Angle 631

15.22.9 Close Front 631

15.22.10 Close Back 632

15.23 3D Lighting Properties 632

15.23.1 Mode 632

15.23.2 Normals Kind 632

15.23.3 Normals Direction 633

15.24 3D Texture Properties 633

15.24.1 Generation Mode 633

15.24.2 Kind 633

15.24.3 Filter 634

15.24.4 Mode 634

15.25 3D Material Properties 634

15.25.1 Colors 634

15.25.2 Shininess 635

15.26 3D Shadow Properties 635

15.26.1 Shadow 635

15.27 Frame Formatting Properties 635

15.27.1 Frame Widths 635

15.27.2 Frame Heights 636

15.27.3 Maximum Width and Height 636

15.27.4 Left and Right Margins 637

15.27.5 Top and Bottom Margins 637

15.27.6 Margins 637

15.27.7 Print Content 637

15.27.8 Protect 637

15.27.9 Horizontal Position 638

15.27.10 Horizontal Relation 639

15.27.11 Vertical Position 640

15.27.12 Vertical Relation 641

15.27.13 Frame Anchor 642

15.27.14 Border 642

15.27.15 Border Line Width 642

15.27.16 Padding 642

15.27.17 Shadow 642

15.27.18 Background 643

15.27.19 Columns 643

15.27.20 Editable 643

15.27.21 Wrapping 643

15.27.22 Dynamic Wrap Threshold 644

15.27.23 Paragraph-only Wrapping 644

15.27.24 Contour Wrapping 644

15.27.25 Contour Wrapping Mode 645

15.27.26 Run Through 645

15.27.27 Flow with Text 645

15.27.28 Overflow behavior 646

15.27.29 Mirroring 646

15.27.30 Clipping 647

15.27.31 Wrap Influence on Position 647

15.28 Floating Frame Formatting Properties 648

15.28.1 Display Scrollbar 648

15.28.2 Display Border 648

15.28.3 Margins 648

15.28.4 Object Formatting Properties 649

15.28.5 Visible Area 649

15.28.6 Draw Aspect 649

15.29 Chart Formatting Properties 650

15.29.1 Scale Text 650

15.30 Chart Subtype Properties 650

15.30.1 Three-dimensional Charts 651

15.30.2 Chart Depth 651

15.30.3 Chart Symbol 651

15.30.4 Chart Symbol Size 652

15.30.5 Bar Chart Properties 652

15.30.6 Stock Chart Properties 653

15.30.7 Line Chart Properties 653

15.30.8 Pie Chart Properties 654

15.30.9 Lines 654

15.30.10 Solid Charts Bars 654

15.30.11 Stacked Chart Bars 655

15.31 Chart Axes Properties 655

15.31.1 Linked Data Formats 655

15.31.2 Visibility 655

15.31.3 Scaling 656

15.31.4 Tick Marks 656

15.31.5 Labels 657

15.32 Common Chart Properties 658

15.32.1 Stacked Text 658

15.32.2 Rotation Angle 658

15.32.3 Data Labels 658

15.33 Statistical Properties 659

15.33.1 Mean Value 659

15.33.2 Error Category 660

15.34 Plot Area Properties 661

15.34.1 Series Source 661

15.35 Regression Curve Properties 662

15.35.1 Regression Type 662

15.36 Presentation Page Attributes 662

15.36.1 Transition Type 663

15.36.2 Transition Style 663

15.36.3 Transition Speed 665

15.36.4 Transition Type or Family 666

15.36.5 Transition Subtype 666

15.36.6 Transition Direction 666

15.36.7 Fade Color 666

15.36.8 Page Duration 667

15.36.9 Page Visibility 667

15.36.10 Sound 667

15.36.11 Background Size 667

15.36.12 Background Objects Visible 668

15.36.13 Background Visible 668

15.36.14 Display Header 668

15.36.15 Display Footer 668

15.36.16 Display Page Number 669

15.36.17 Display Date And Time 669

16 Data Types and Schema Definitions 670

16.1 Data Types 670

16.2 Other Definitions 675

16.3 Relax-NG Schema Suffix 676

17 Packages 677

17.1 Introduction 677

17.2 Zip File Structure 677

17.3 Encryption 678

17.4 MIME Type Stream 678

17.5 Usage of IRIs Within Packages 679

17.6 Preview Image 679

17.7 Manifest File 679

17.7.1 Relax-NG Schema 680

17.7.2 Manifest Root Element 680

17.7.3 File Entry 680

17.7.4 Encryption Data 681

17.7.5 Algorithm 682

17.7.6 Key Derivation 683

17.7.7 Relax-NG Schema Suffix 684

Appendix A. Strict Relax NG Schema 686

Appendix B. References 688

Appendix C. MIME Types and File Name Extensions (Non Normative) 690

Appendix D. Core Features Sets (Non Normative) 692

Appendix E. Changes From Previous Specification Versions (Non Normative) 697

E.1. Changes from “Open Office Specification 1.0 Committee Draft 1” 697

E.2. Changes from “Open Document Format for Office Applications (OpenDocument) 1.0 Committee Draft 2” 697

E.3. Changes from “Open Document Format for Office Applications (OpenDocument) v1.0” 698

Appendix F. Acknowledgments (Non Normative) 699

Appendix G. Notices 701



1Introduction

1.1Introduction

This document defines an XML schema for office applications and its semantics. The schema is suitable for office documents, including text documents, spreadsheets, charts and graphical documents like drawings or presentations, but is not restricted to these kinds of documents.

The schema provides for high-level information suitable for editing documents. It defines suitable XML structures for office documents and is friendly to transformations using XSLT or similar XML-based tools.

Chapter 1 contains the introduction to the OpenDocument format. The structure of documents that conform to the OpenDocument specification is explained in chapter 2. Chapter 3 described the meta information that can be contained in such documents. Chapters 4 and 5 describe their text and paragraph content. Text Fields are described in chapter 6, text indices in chapter 7.

Chapter 8 describes the table content of a document in OpenDocument format, chapter 9 its graphical content, chapter 10 its chart content, and chapter 11 its form content. Content that is common to all documents is described in chapter 12. The integration of SMIL animation markup into the OpenDocument schema is described in chapter 13. Chapter 14 explains style information content, chapter 15 specifies formatting properties that are can be used within styles. The data types used by the OpenDocument schema are described in chapter 16.

The OpenDocument format makes use of a package concept. These packages are described in chapter 17.

1.2Notation

Within this specification, the key words "shall", "shall not", "should", "should not" and "may" are to be interpreted as described in Annex H of [ISO/IEC Directives] if they appear in bold letters.

1.3Namespaces

Table 1 lists the namespaces that are defined by the OpenDocument format and their default prefixes. For more information about XML namespaces, please refer to the Namespaces in XML specification [xml-names].

Table 1: XML Namespaces defined by the OpenDocument schema

Prefix

Description

Namespace

office

For all common pieces of information that are not contained in another, more specific namespace.

urn:oasis:names:tc:opendocument:xmlns:
office:1.0

meta

For elements and attributes that describe meta information.

urn:oasis:names:tc:opendocument:xmlns:
meta:1.0

config

For elements and attributes that describe application specific settings.

urn:oasis:names:tc:opendocument:xmlns:
config:1.0

text

For elements and attributes that may occur within text documents and text parts of other document types, such as the contents of a spreadsheet cell.

urn:oasis:names:tc:opendocument:xmlns:
text:1.0

table

For elements and attributes that may occur within spreadsheets or within table definitions of a text document.

urn:oasis:names:tc:opendocument:xmlns:
table:1.0

drawing

For elements and attributes that describe graphic content.

urn:oasis:names:tc:opendocument:xmlns:
drawing:1.0

presentation

For elements and attributes that describe presentation content.

urn:oasis:names:tc:opendocument:xmlns:
presentation:1.0

dr3d

For elements and attributes that describe 3D graphic content.

urn:oasis:names:tc:opendocument:xmlns:
dr3d:1.0

anim

For elements and attributes that describe animation content.

urn:oasis:names:tc:opendocument:xmlns:
animation:1.0

chart

For elements and attributes that describe chart content.

urn:oasis:names:tc:opendocument:xmlns:
chart:1.0

form

For elements and attributes that describe forms and controls.

urn:oasis:names:tc:opendocument:xmlns:
form:1.0

script

For elements and attributes that represent scripts or events.

urn:oasis:names:tc:opendocument:xmlns:
script:1.0

style

For elements and attributes that describe the style and inheritance model used by the OpenDocument format as well as some common formatting attributes.

urn:oasis:names:tc:opendocument:xmlns:
style:1.0

number

For elements and attributes that describe data style information.

urn:oasis:names:tc:opendocument:xmlns:
data style:1.0

manifest

For elements and attribute contained in the package manifest.

urn:oasis:names:tc:opendocument:xmlns:
manifest:1.0

Table 2 lists the namespaces that are defined by the OpenDocument format, but contain elements and attributes whose semantics are compatible to elements and attributes from other specifications.

Table 2: XML Namespaces defined by the OpenDocument schema that include elements and attributes that are compatible to elements and attributes of other standards.

Prefix

Description

Namespace

fo

For attributes that are compatible to attributes defined in [XSL].

urn:oasis:names:tc:opendocument:xmlns:
xsl-fo-compatible:1.0

svg

For elements and attributes that are compatible to elements or attributes defined in [SVG].

urn:oasis:names:tc:opendocument:xmlns:
svg-compatible:1.0

smil

For attributes that are compatible to attributes defined in [SMIL20].

urn:oasis:names:tc:opendocument:xmlns:
smil-compatible:1.0

Table 3 lists the namespaces that are imported into the OpenDocument format and their default prefixes.

Table 3: XML Namespaces used by the OpenDocument schema

Prefix

Description

Namespace

dc

The Dublin Core Namespace (see [DCMI]).

http://purl.org/dc/elements/1.1/

xlink

The XLink namespace (see [XLink]).

http://www.w3.org/1999/xlink

math

MathML Namespace (see [MathML])

http://www.w3.org/1998/Math/MathML

xforms

The XForms namespace (see [XForms]).

http://www.w3.org/2002/xforms

1.4Relax-NG Schema

The normative XML Schema for the OpenDocument format is embedded within this specification. It can be obtained from the specification document by concatenating all schema fragments contained in chapters 1 to 16. All schema fragments have a gray background color and line numbers.

The schema language used within this specification is Relax-NG (see [RNG]). The attribute default value feature specified in [RNG-Compat] is used to provide attribute default values.

The schema provided in this specification permits arbitrary content within meta information elements and formatting properties elements as described in section 1.5. Appendix A contains a schema that restricts the content within these elements to the attributes and elements defined in this specification.

Prefix for the normative Relax-NG schema:

<?xml version="1.0" encoding="UTF-8"?>

<!--

OASIS OpenDocument v1.0 (Second Edition)

Committee Specification1, 19 Jul 2006

Relax-NG Schema


$Id$


© 2002-2005 OASIS Open

© 1999-2005 Sun Microsystems, Inc.

-->


<grammar

xmlns="http://relaxng.org/ns/structure/1.0"

xmlns:a="http://relaxng.org/ns/compatibility/annotations/1.0"


datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes"


xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0"

xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0"

xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0"

xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0"

xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0"

xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0"

xmlns:presentation="urn:oasis:names:tc:opendocument:xmlns:presentation:1.0"

xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0"

xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0"

xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0"

xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0"

xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0"

xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0"

xmlns:anim="urn:oasis:names:tc:opendocument:xmlns:animation:1.0"


xmlns:dc="http://purl.org/dc/elements/1.1/"

xmlns:xlink="http://www.w3.org/1999/xlink"

xmlns:math="http://www.w3.org/1998/Math/MathML"

xmlns:xforms="http://www.w3.org/2002/xforms"


xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0"

xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0"

xmlns:smil="urn:oasis:names:tc:opendocument:xmlns:smil-compatible:1.0"

>

1.5Document Processing and Conformance

Documents that conform to the OpenDocument specification may contain elements and attributes not specified within the OpenDocument schema. Such elements and attributes must not be part of a namespace that is defined within this specification and are called foreign elements and attributes.

Conforming applications either shall read documents that are valid against the OpenDocument schema if all foreign elements and attributes are removed before validation takes place, or shall write documents that are valid against the OpenDocument schema if all foreign elements and attributes are removed before validation takes place.

Conforming applications that read and write documents may preserve foreign elements and attributes.

In addition to this, conforming applications should preserve meta information and the content of styles. This means:

Foreign elements may have an office:process-content attribute attached that has the value true or false. If the attribute's value is true, or if the attribute does not exist, the element's content should be processed by conforming applications. Otherwise conforming applications should not process the element's content, but may only preserve its content. If the element's content should be processed, the document itself shall be valid against the OpenDocument schema if the unknown element is replaced with its content only.

Conforming applications shall read documents containing processing instructions and should preserve them.

There are no rules regarding the elements and attributes that actually have to be supported by conforming applications, except that applications should not use foreign elements and attributes for features by the OpenDocument schema. See also appendix D.

<define name="office-process-content">

<optional>

<attribute name="office:process-content" a:defaultValue="true">

<ref name="boolean"/>

</attribute>

</optional>

</define>

1.6White-Space Processing and EOL Handling

In conformance with the W3C XML specification [XML1.0], optional white-space characters that are contained in elements that have element content (in other words that must contain elements only but not text) are ignored. This applies to the following white-space and end-of-line (EOL) [UNICODE] characters:

For any other element, white-spaces are preserved by default. Unless otherwise stated, there is no special processing for any of the four white-space characters. For some elements, different white-space processing may take place, for example the paragraph element.

The XML specification also requires that any of the four white-space characters that is contained in an attribute value is normalized to a SPACE character.

One of the following characters may be used to represent line ends:

Conforming to the XML specification, all the possible line ends are normalized to a single LINE FEED character.

As a consequence of the white-space and EOL processing rules, any CARRIAGE RETURN characters that are contained either in the text content of an element or in an attribute value must be encoded by the character entity &#x0D;. The same applies to the HORIZONTAL TABULATION and LINE FEED characters if they are contained in an attribute value.

1.7MIME Types and File Name Extensions

Appendix C contains a list of MIME types and file name extensions to be used for office documents that conform to this specification and that are contained in a package (see section 2.1). This MIME types and extensions either have been registered following the procedures described in [RFC2048], or a registration is in progress.

Office documents that conform to this specification but are not contained in a package should use the MIME type text/xml.

Only MIME types and extensions that have been registered according to [RFC2048] should used for office documents that conform to this specification. The MIME types and extensions listed in appendix C should be used where appropriate.

2Document Structure

This chapter introduces the structure of the OpenDocument format. The chapter contains the following sections:

In the OpenDocument format, each structural component is represented by an element, with associated attributes. The structure of a document in OpenDocument format applies to all document types. There is no difference between a text document, a spreadsheet or a drawing, apart from the content. Also, all document types may contain different styles. Document content that is common to all document types can be exchanged from one type of document to another.

2.1Document Roots

A document root element is the primary element of a document in OpenDocument format. It contains the entire document. All types of documents, for example, text documents, spreadsheets, and drawing documents use the same types of document root elements.

The OpenDocument format supports the following two ways of document representation:

There are four types of subdocuments, each with different root elements. Additionally, the single XML document has its own root element, for a total of five different supported root elements. The root elements are summarized in the following table:

Root Element

Subdocument Content

Subdoc. Name in Package

<office:document>

Complete office document in a single XML document.

n/a

<office:document-content>

Document content and automatic styles used in the content.

content.xml

<office:document-styles>

Styles used in the document content and automatic styles used in the styles themselves.

styles.xml

<office:document-meta>

Document meta information, such as the author or the time of the last save action.

meta.xml

<office:document-settings>

Application-specific settings, such as the window size or printer information.

settings.xml

The definitions of the root elements described in the table above are analogous to the definition of <office:document>, except that the child element specification is suitably restricted.

<start>

<choice>

<ref name="office-document"/>

<ref name="office-document-content"/>

<ref name="office-document-styles"/>

<ref name="office-document-meta"/>

<ref name="office-document-settings"/>

</choice>

</start>

2.1.1Document Root Element Content Models

The content models of the five root elements is summarized in the following table. Note that <office:document> may contain all supported top-level elements. None of the four subdocument root elements contain the complete data, but four combined do.

Root Element

meta data

app. sett.

script

font decls

style

auto style

mast style

body

<office:document>

X

X

X

X

X

X

X

X

<office:document-content>



X

X


X


X

<office:document-styles>




X

X

X

X


<office:document-meta>

X








<office:document-settings>


X







The <office:document> root contains a complete document:

<define name="office-document">

<element name="office:document">

<ref name="office-document-attrs"/>

<ref name="office-document-common-attrs"/>

<ref name="office-meta"/>

<ref name="office-settings"/>

<ref name="office-scripts"/>

<ref name="office-font-face-decls"/>

<ref name="office-styles"/>

<ref name="office-automatic-styles"/>

<ref name="office-master-styles"/>

<ref name="office-body"/>

</element>

</define>

The <office:document-content> root contains only the document content, along with the automatic styles needed for the document content:

<define name="office-document-content">

<element name="office:document-content">

<ref name="office-document-common-attrs"/>

<ref name="office-scripts"/>

<ref name="office-font-face-decls"/>

<ref name="office-automatic-styles"/>

<ref name="office-body"/>

</element>

</define>

The <office:document-styles> root contains all named styles of a document, along with the automatic styles needed for the named styles:

<define name="office-document-styles">

<element name="office:document-styles">

<ref name="office-document-common-attrs"/>

<ref name="office-font-face-decls"/>

<ref name="office-styles"/>

<ref name="office-automatic-styles"/>

<ref name="office-master-styles"/>

</element>

</define>

The <office:document-meta> root contains the meta information about a document.

<define name="office-document-meta">

<element name="office:document-meta">

<ref name="office-document-common-attrs"/>

<ref name="office-meta"/>

</element>

</define>

The <office:document-settings> root contains application specific settings to be applied when processing this document.

<define name="office-document-settings">

<element name="office:document-settings">

<ref name="office-document-common-attrs"/>

<ref name="office-settings"/>

</element>

</define>

2.1.2Document Root Attributes

Version

All root elements take an office:version attribute, which indicates which version of this specification it complies with. The version number is in the format revision.version. If the file has a version known to an XML processor, it may validate the document. Otherwise, it is optional to validate the document, but the document must be well formed.

<define name="office-document-common-attrs" combine="interleave">

<optional>

<attribute name="office:version">

<ref name="string"/>

</attribute>

</optional>

</define>

MIME Type

The <office:document> element takes an office:mimetype attribute, which indicates the type of document (text, spreadsheet etc.). This attribute is especially important for flat XML files, where this is the only way the type of document can be detected (in a package, the MIME type is also present in a separate file, see section 17.4). Its values are the MIME types that are used for the packaged variant of office documents (see section 1.7).

<define name="office-document-attrs" combine="interleave">

<attribute name="office:mimetype">

<ref name="string"/>

</attribute>

</define>

2.2Document Metadata

Metadata is general information about a document. In the OpenDocument format, all of the metadata elements are contained in an <office:meta> element, usually located at start of the document. Metadata elements may be omitted or occur multiple times. It is application-specific how to update multiple instances of the same elements.

<define name="office-meta">

<optional>

<element name="office:meta">

<ref name="office-meta-content"/>

</element>

</optional>

</define>


<define name="office-meta-content">

<ref name="anyElements"/>

</define>


<define name="office-meta-content-strict">

<zeroOrMore>

<ref name="office-meta-data"/>

</zeroOrMore>

</define>

2.2.1Pre-Defined vs. Custom Metadata

In the OpenDocument schema the metadata is comprised of pre-defined metadata elements, user defined metadata, as well as custom metadata elements. The pre-defined metadata elements have defined semantics. They should be processed and updated by editing applications. They can be referenced from within the document through the use of suitable text fields.

User-defined metadata is a more generic mechanism which specifies a triplet of name, type, and value. Supporting applications can present these value to the user, making use of the supplied data type. The user-defined metadata can be referenced from within the document through the use of suitable text fields.

Custom metadata are arbitrary elements inside <office:meta>. Since their semantics is not defined in this specification, conforming applications in general cannot process or display this data. Applications should preserve this data when editing the document.

2.2.2Sample Metadata

Example: Sample metadata of a document in OpenDocument format

<office:meta>

<dc:title>Title of the document</dc:title>

<dc:description>Description/Comment for the document</dc:description>

<meta:initial-creator>User Name</meta:initial-creator>

<meta:creation-date>1999-10-18T12:34:56</meta:creation-date>

<dc:creator>User Name</dc:creator>

<dc:date>1999-10-19T15:16:17</dc:date>

<meta:printed-by>User Name</meta:printed-by>

<meta:print-date>1999-10-20T16:17:18</meta:print-date>

<dc:subject>Description of the document</dc:subject>

<meta:editing-duration>PT5H10M10S</meta:editing-duration>

<meta:keyword>First keyword</meta:keyword>

<meta:keyword>Second keyword</meta:keyword>

<meta:keyword>Third keyword</meta:keyword>

<meta:template xlink:type="simple"

xlink:href="file:///c|/office52/share/template/german/finance/budget.vor"

xlink:title="Template name"

meta:date="1999-10-15T10:11:12" />

<meta:auto-reload

xlink:type="simple"

xlink:href="file:///..."

meta:delay="P60S" />

<dc:language>de-DE</dc:language>

<meta:user-defined meta:name="Field 1"

meta:value-type="string">Value 1</meta:user-defined>

<meta:user-defined meta:name="Field 2"

meta:value-type="float">1.234</meta:user-defined>

</office:meta>

2.3Body Element and Document Types

The document body contains an element to indicate which type of content this document contains. Currently supported document types are:

All document types share the same content elements, but different document types place different restrictions on which elements may occur, and in what combinations. The document content is typically framed by a prelude and epilogue, which contain additional information for a specific type of document, like form data or variable declarations.

<define name="office-body">

<element name="office:body">

<ref name="office-body-content"/>

</element>

</define>

2.3.1Text Documents

The content of text documents mainly consists of a sequence containing any number of paragraphs, tables, indices, text frames, text sections, and graphical elements. Additionally, a text document may contain forms, change tracking information and variable declarations. Each of these is defined in the document prelude, and may be referenced from the document content.

<define name="office-body-content" combine="choice">

<element name="office:text">

<ref name="office-text-attlist"/>

<ref name="office-text-content-prelude"/>

<zeroOrMore>

<ref name="office-text-content-main"/>

</zeroOrMore>

<ref name="office-text-content-epilogue"/>

</element>

</define>

Text Document Content Model

The text document prelude contains the document's form data, change tracking information, and variable declarations. To allow office applications to implement functionality that usually is available in spreadsheets for text documents, it may also contain elements that implement enhanced table features. See also section 2.3.4.

<define name="office-text-content-prelude">

<ref name="office-forms"/>

<ref name="text-tracked-changes"/>

<ref name="text-decls"/>

<ref name="table-decls"/>

</define>

The main document content contains any sequence of text content elements, which includes paragraphs (and headings), text sections (and indices), tables, and graphical shapes. As an alternative, a text document may contain of a single page sequence.

It is not required that a text document contains a paragraph. A text document may consist of a sequence frames only.

<define name="office-text-content-main">

<choice>

<zeroOrMore>

<ref name="text-content"/>

</zeroOrMore>

<group>

<ref name="text-page-sequence"/>

<zeroOrMore>

<choice>

<ref name="draw-a"/>

<ref name="shape"/>

</choice>

</zeroOrMore>

</group>

</choice>

</define>


<define name="text-content">

<choice>

<ref name="text-h"/>

<ref name="text-p"/>

<ref name="text-list"/>

<ref name="text-numbered-paragraph"/>

<ref name="table-table"/>

<ref name="draw-a"/>

<ref name="text-section"/>

<ref name="text-table-of-content"/>

<ref name="text-illustration-index"/>

<ref name="text-table-index"/>

<ref name="text-object-index"/>

<ref name="text-user-index"/>

<ref name="text-alphabetical-index"/>

<ref name="text-bibliography"/>

<ref name="shape"/>

<ref name="change-marks"/>

</choice>

</define>

There are no text documents specific epilogue elements, but the epilogue may contain elements that implement enhanced table features. See also section 2.3.4.

<define name="office-text-content-epilogue">

<ref name="table-functions"/>

</define>

Global Text Documents

There is a common use case for large documents to be edited in separate entities, such that there is a 'global' document, containing several linked constituent subdocuments. This can be implemented by using linked text sections (see section 4.4). To facilitate an editing application adapting the user interface to better support the notion of 'global' document with constituent parts (as opposed to a document with arbitrary linked content), the text:global flag can be used. If set to true, it informs applications that linked sections in this document have part-of semantics. The actual XML representation of the sections does not change.

<define name="office-text-attlist" combine="interleave">

<optional>

<attribute name="text:global" a:defaultValue="false">

<ref name="boolean"/>

</attribute>

</optional>

</define>

2.3.2Drawing Documents

The content of drawing document consists of a sequence of draw pages.

<define name="office-body-content" combine="choice">

<element name="office:drawing">

<ref name="office-drawing-attlist"/>

<ref name="office-drawing-content-prelude"/>

<ref name="office-drawing-content-main"/>

<ref name="office-drawing-content-epilogue"/>

</element>

</define>


<define name="office-drawing-attlist">

<empty/>

</define>

Drawing Document Content Model

The drawing document prelude may contain text declarations only. To allow office applications to implement functionality that usually is available in spreadsheets for drawing documents, it may also contain elements that implement enhanced table features. See also section 2.3.4.

<define name="office-drawing-content-prelude">

<ref name="text-decls"/>

<ref name="table-decls"/>

</define>

The main document content contains a sequence of draw pages.

<define name="office-drawing-content-main">

<zeroOrMore>

<ref name="draw-page"/>

</zeroOrMore>

</define>

There are no drawing documents specific epilogue elements, but the epilogue may contain elements that implement enhanced table features. See also section 2.3.4.

<define name="office-drawing-content-epilogue">

<ref name="table-functions"/>

</define>

2.3.3Presentation Documents

The content of presentation document consists of a sequence of draw pages.

<define name="office-body-content" combine="choice">

<element name="office:presentation">

<ref name="office-presentation-attlist"/>

<ref name="office-presentation-content-prelude"/>

<ref name="office-presentation-content-main"/>

<ref name="office-presentation-content-epilogue"/>

</element>

</define>


<define name="office-presentation-attlist">

<empty/>

</define>

Presentation Document Content Model

The presentation document prelude equals the one of a drawing document, but may contain some additional declarations. See also section 2.3.2.

<define name="office-presentation-content-prelude">

<ref name="text-decls"/>

<ref name="table-decls"/>

<ref name="presentation-decls"/>

</define>

The main document content contains a sequence of draw pages.

<define name="office-presentation-content-main">

<zeroOrMore>

<ref name="draw-page"/>

</zeroOrMore>

</define>

The epilogue of presentation documents may contain presentation settings. Additionally, it may contain elements that implement enhanced table features. See also section 2.3.4.

<define name="office-presentation-content-epilogue">

<ref name="presentation-settings"/>

<ref name="table-functions"/>

</define>

2.3.4Spreadsheet Documents

The content of spreadsheet documents mainly consists of a sequence of tables. Additionally, a spreadsheet document may contain forms, change tracking information and various kinds of declarations that simplify the usage of spreadsheet tables and their analysis. Each of these are contained in either the document prelude, or the document epilogue.

<define name="office-body-content" combine="choice">

<element name="office:spreadsheet">

<ref name="office-spreadsheet-attlist"/>

<ref name="office-spreadsheet-content-prelude"/>

<ref name="office-spreadsheet-content-main"/>

<ref name="office-spreadsheet-content-epilogue"/>

</element>

</define>

Spreadsheet Document Content Model

The spreadsheet document prelude contains the document's form data, change tracking information, calculation setting for formulas, validation rules for cell content and declarations for label ranges.

<define name="office-spreadsheet-content-prelude">

<optional>

<ref name="table-tracked-changes"/>

</optional>

<ref name="text-decls"/>

<ref name="table-decls"/>

</define>


<define name="table-decls">

<optional>

<ref name="table-calculation-settings"/>

</optional>

<optional>

<ref name="table-content-validations"/>

</optional>

<optional>

<ref name="table-label-ranges"/>

</optional>

</define>

The main document is a list of tables.

<define name="office-spreadsheet-content-main">

<zeroOrMore>

<ref name="table-table"/>

</zeroOrMore>

</define>

The epilogue of spreadsheet documents contains declarations for named expressions, database ranges, data pilot tables, consolidation operations and DDE links.

<define name="office-spreadsheet-content-epilogue">

<ref name="table-functions"/>

</define>


<define name="table-functions">

<optional>

<ref name="table-named-expressions"/>

</optional>

<optional>

<ref name="table-database-ranges"/>

</optional>

<optional>

<ref name="table-data-pilot-tables"/>

</optional>

<optional>

<ref name="table-consolidation"/>

</optional>

<optional>

<ref name="table-dde-links"/>

</optional>

</define>

2.3.5Chart Documents

The content of chart documents mainly consists of a chart element.

<define name="office-body-content" combine="choice">

<element name="office:chart">

<ref name="office-chart-attlist"/>

<ref name="office-chart-content-prelude"/>

<ref name="office-chart-content-main"/>

<ref name="office-chart-content-epilogue"/>

</element>

</define>


<define name="office-chart-attlist">

<empty/>

</define>

Chart Document Content Model

To allow office applications to implement functionality that usually is available in spreadsheets for the table that may be contained in a chart, the chart document prelude may contain elements that implement enhanced table features. See also section 2.3.4.

<define name="office-chart-content-prelude">

<ref name="text-decls"/>

<ref name="table-decls"/>

</define>

The main document is a chart element only.

<define name="office-chart-content-main">

<ref name="chart-chart"/>

</define>

There are no chart documents specific epilogue elements, but the epilogue may contain elements that implement enhanced table features. See also section 2.3.4.

<define name="office-chart-content-epilogue">

<ref name="table-functions"/>

</define>

2.3.6Image Documents

The content of an image document is a frame element only. The frame element must contain a single image element.

<define name="office-body-content" combine="choice">

<element name="office:image">

<ref name="office-image-attlist"/>

<ref name="office-image-content-prelude"/>

<ref name="office-image-content-main"/>

<ref name="office-image-content-epilogue"/>

</element>

</define>


<define name="office-image-attlist">

<empty/>

</define>

Image Document Content Model

The image document prelude is empty.

<define name="office-image-content-prelude">

<empty/>

</define>

The main document content contains a frame only.

<define name="office-image-content-main">

<ref name="draw-frame"/>

</define>

There are no image documents specific epilogue elements.

<define name="office-image-content-epilogue">

<empty/>

</define>

2.4Application Settings

Application settings are contained in a <office:settings> element.

<define name="office-settings">

<optional>

<element name="office:settings">

<oneOrMore>

<ref name="config-config-item-set"/>

</oneOrMore>

</element>

</optional>

</define>

The settings for office applications may be divided into several categories each represented by a <config:config-item-set> element. For instance the following two categories may exist:

2.4.1Sequence of Settings

The <config:config-item-set> element is a container element for all types of setting elements. The settings can be contained in the element is any order.

<define name="config-config-item-set">

<element name="config:config-item-set">

<ref name="config-config-item-set-attlist"/>

<ref name="config-items"/>

</element>

</define>


<define name="config-items">

<oneOrMore>

<choice>

<ref name="config-config-item"/>

<ref name="config-config-item-set"/>

<ref name="config-config-item-map-named"/>

<ref name="config-config-item-map-indexed"/>

</choice>

</oneOrMore>

</define>

Config Name

The config:name attribute identifies the name of the setting container. For top level <config:config-item-set> elements, that are elements that are direct children of the <office:settings> element, the name should be preceded by a namespace prefix that identifies the application the settings belong to.

<define name="config-config-item-set-attlist" combine="interleave">

<attribute name="config:name">

<ref name="string"/>

</attribute>

</define>

Example:

<office:settings>

<config:config-item-set xmlns:ooo="http://www.openoffice.org/...";

config:name="ooo:view-settings">

<config:config-item config:name="ViewAreaTop"

config:type="int">0</config:config-item>

</config:config-item-set>

</office:settings>

2.4.2Base Settings

The <config:config-item> element contains all base settings. The value of the setting is stored in the element.

<define name="config-config-item">

<element name="config:config-item">

<ref name="config-config-item-attlist"/>

<text/>

</element>

</define>

Config Name

The config:name attribute identifies the name of the setting.

<define name="config-config-item-attlist" combine="interleave">

<attribute name="config:name">

<ref name="string"/>

</attribute>

</define>

Config Type

The config:type attribute identifies the data type of setting.

<define name="config-config-item-attlist" combine="interleave">

<attribute name="config:type">

<choice>

<value>boolean</value>

<value>short</value>

<value>int</value>

<value>long</value>

<value>double</value>

<value>string</value>

<value>datetime</value>

<value>base64Binary</value>

</choice>

</attribute>

</define>

2.4.3Index Access of Sequences

The <config:config-item-map-indexed> element is a container element for sequences. The order specifies the index of the elements

<define name="config-config-item-map-indexed">

<element name="config:config-item-map-indexed">

<ref name="config-config-item-map-indexed-attlist"/>

<oneOrMore>

<ref name="config-config-item-map-entry"/>

</oneOrMore>

</element>

</define>

Config Name

The config:name attribute identifies the name of the setting sequence.

<define name="config-config-item-map-indexed-attlist" combine="interleave">

<attribute name="config:name">

<ref name="string"/>

</attribute>

</define>

2.4.4Map Entry

The <config:config-item-map-entry> element represents an entry in an indexed or named settings sequence. It is a container element for all types of setting elements.

<define name="config-config-item-map-entry">

<element name="config:config-item-map-entry">

<ref name="config-config-item-map-entry-attlist"/>

<ref name="config-items"/>

</element>

</define>

Config Name

The config:name attribute identifies the name of the setting sequence.

<define name="config-config-item-map-entry-attlist" combine="interleave">

<optional>

<attribute name="config:name">

<ref name="string"/>

</attribute>

</optional>

</define>

2.4.5Name Access of Sequences

The <config:config-item-map-named> element is a container element for sequences, where each setting in the sequence is identified by its name.

<define name="config-config-item-map-named">

<element name="config:config-item-map-named">

<ref name="config-config-item-map-named-attlist"/>

<oneOrMore>

<ref name="config-config-item-map-entry"/>

</oneOrMore>

</element>

</define>

Config Name

The config:name attribute identifies the name of the setting sequence.

<define name="config-config-item-map-named-attlist" combine="interleave">

<attribute name="config:name">

<ref name="string"/>

</attribute>

</define>

2.4.6Cursor Position Setting

A common view setting for editing applications is the position where the text cursor was while saving the document. For WYSIWYG applications, this usually will be a position within a paragraph only. For applications that provide an XML based view of the document, the cursor position could be also between arbitrary elements, or even within tags.

To represent a text cursor position within a document, a processing instruction with PITarget opendocument (see §2.6 of [XML1.0]) should be used. The name of the cursor position processing instruction, cursor-position, shall follow the PITarget opendocument. The processing instruction may have arbitrary application specific attributes, for instance to connect the cursor position with a certain view of the document, where the views themselves are specified as application specific settings. The syntax for these attributes shall be the same as for attributes within XML start tags.

Where a text cursor position is not sufficient to recreate a document view, applications may use arbitrary document specific settings in addition to the cursor position processing instruction. They may also use arbitrary document specific settings if the cursor position is not a text cursor position, but for instance a selection of drawing objects.

Example: cursor position processing instruction

<text:p>This is<?opendocument cursor-position view-id="view1"?> an example.</text:p>

2.5Scripts

A document may contain several scripts in different scripting languages. Each script is represented by a <office:script> element. All these script elements are contained in a single <office:scripts> element.

Scripts do not imply a scripting language or an object model. A script can operate on the Document Object Model (DOM) of a document in OpenDocument format or on an application specific API.

Scripts cannot modify a document while the document is loading. However, some events are called immediately after the document is loaded.

In addition to <office:script> elements, the <office:scripts> element may also contain an <office:event-listeners> element which contains the events assigned to the document itself. Examples for these are events called when the document is opened or closed. See section 12.4 for more information on the <office:event-listeners> element.

<define name="office-scripts">

<optional>

<element name="office:scripts">

<zeroOrMore>

<ref name="office-script"/>

</zeroOrMore>

<optional>

<ref name="office-event-listeners"/>

</optional>

</element>

</optional>

</define>

2.5.1Script

The <office:script> element contains script language specific content. In most situations, the element contains the source code of the script, but it may also contain a compiled version of the script or a link to some external script code.

<define name="office-script">

<element name="office:script">

<ref name="office-script-attlist"/>

<mixed>

<ref name="anyElements"/>

</mixed>

</element>

</define>

Script Language

The attribute script:language specifies the language of the script by its name. Since script language names are application specific, the name should be preceded by a namespace prefix.

<define name="office-script-attlist">

<attribute name="script:language">

<ref name="string"/>

</attribute>

</define>

2.6Font Face Declarations

A document in OpenDocument format may contain font face declarations. A font face declaration provides information about the fonts used by the author of a document, so that these fonts or fonts that are very close to these fonts may be located on other systems. See section 14.6 for details.

<define name="office-font-face-decls">

<optional>

<element name="office:font-face-decls">

<zeroOrMore>

<ref name="style-font-face"/>

</zeroOrMore>

</element>

</optional>

</define>

2.7Styles

The OpenDocument format supports the following types of styles:

As far as the office application user is concerned, all types of styles are part of the document. They represent the output device-independent layout and formatting information that the author of a document has used to create or edit the document. The assumption is that the author of the document wants this formatting and layout information to be preserved when the document is reloaded or displayed on any device, because this is common practice for documents created by word processors.

This type of style information differs from [CSS2] or [XSLT] style sheets that are used to display a document. An additional style sheet for CSS, XSLT, and so on, is required to display a document in OpenDocument format on a certain device. This style sheet must take into account the styles in the document as well as the requirements and capabilities of the output device. The ideal case is that this style sheet depends on the output device only.

See section 14 for more information on styles.

2.7.1Location of Styles

Common and automatic styles have the same XML representation, but they are contained within two distinct container elements, as follows:

<define name="office-styles">

<optional>

<element name="office:styles">

<interleave>

<ref name="styles"/>

<zeroOrMore>

<ref name="style-default-style"/>

</zeroOrMore>

<optional>

<ref name="text-outline-style"/>

</optional>

<zeroOrMore>

<ref name="text-notes-configuration"/>

</zeroOrMore>

<optional>

<ref name="text-bibliography-configuration"/>

</optional>

<optional>

<ref name="text-linenumbering-configuration"/>

</optional>

<zeroOrMore>

<ref name="draw-gradient"/>

</zeroOrMore>

<zeroOrMore>

<ref name="svg-linearGradient"/>

</zeroOrMore>

<zeroOrMore>

<ref name="svg-radialGradient"/>

</zeroOrMore>

<zeroOrMore>

<ref name="draw-hatch"/>

</zeroOrMore>

<zeroOrMore>

<ref name="draw-fill-image"/>

</zeroOrMore>

<zeroOrMore>

<ref name="draw-marker"/>

</zeroOrMore>

<zeroOrMore>

<ref name="draw-stroke-dash"/>

</zeroOrMore>

<zeroOrMore>

<ref name="draw-opacity"/>

</zeroOrMore>

<zeroOrMore>

<ref name="style-presentation-page-layout"/>

</zeroOrMore>

</interleave>

</element>

</optional>

</define>

<define name="office-automatic-styles">

<optional>

<element name="office:automatic-styles">

<interleave>

<ref name="styles"/>

<zeroOrMore>

<ref name="style-page-layout"/>

</zeroOrMore>

</interleave>

</element>

</optional>

</define>

<define name="office-master-styles">

<optional>

<element name="office:master-styles">

<interleave>

<zeroOrMore>

<ref name="style-master-page"/>

</zeroOrMore>

<optional>

<ref name="style-handout-master"/>

</optional>

<optional>

<ref name="draw-layer-set"/>

</optional>

</interleave>

</element>

</optional>

</define>


<define name="styles">

<interleave>

<zeroOrMore>

<ref name="style-style"/>

</zeroOrMore>

<zeroOrMore>

<ref name="text-list-style"/>

</zeroOrMore>

<zeroOrMore>

<ref name="number-number-style"/>

</zeroOrMore>

<zeroOrMore>

<ref name="number-currency-style"/>

</zeroOrMore>

<zeroOrMore>

<ref name="number-percentage-style"/>

</zeroOrMore>

<zeroOrMore>

<ref name="number-date-style"/>

</zeroOrMore>

<zeroOrMore>

<ref name="number-time-style"/>

</zeroOrMore>

<zeroOrMore>

<ref name="number-boolean-style"/>

</zeroOrMore>

<zeroOrMore>

<ref name="number-text-style"/>

</zeroOrMore>

</interleave>

</define>

The following examples illustrate the different types of OpenDocument styles.

Example: OpenDocument styles

<office:document ...>

<office:styles>

...

</office:styles>

<office:automatic-styles>

...

</office:automatic-styles>

<office:master-styles>

...

</office:master-styles>

</office:document>

2.8Page Styles and Layout

The style and layout of the pages in a document is determined by:

A page layout describes the physical properties or geometry of a page, for example, page size, margins, header height, and footer height.

A master page is a template for pages in a document. It contains a reference to a page layout which specifies the physical properties of the page and can also contain static content that is displayed on all pages in the document that use the master page. Examples of static content are headers, footers, or background graphics.

If a text or spreadsheet document is displayed in a paged layout, the master pages are instantiated to generate a sequence of pages containing the document content. When a master page is instantiated, an empty page is generated with the properties of the page master and the static content of the master page. The body of the page is then filled with content. If multiple pages in a document use the same master page, the master page can be instantiated several times within the document.

In text and spreadsheet documents, a master page can be assigned to paragraph and table styles using a style:master-page-name attribute. Each time the paragraph or table style is applied to text, a page break is inserted before the paragraph or table. The page that starts at the page break position uses the specified master page.

In drawings and presentations, master pages can be assigned to drawing pages using a style:parent-style-name attribute.

Note: The OpenDocument paging methodology differs significantly from the methodology used in [XSL]. In XSL, headers and footers are contained within page sequences that also contain the document content. In the OpenDocument format, headers and footers are contained in page styles. With either approach, the content of headers and footers can be changed or omitted without affecting the document content.

Page layouts are described in section 14.3. Master pages are described in section 14.4.

3Meta Data Elements

The metadata elements borrow heavily upon the metadata standards developed by the Dublin Core Metadata Initiative (http://www.dublincore.org). Metadata elements drawn directly from the Dublin Core work use its namespace prefix (see section 1.3).

3.1Pre-Defined Metadata Elements

There is a set of pre-defined metadata elements which should be processed and updated by the applications. Metadata elements may be omitted or occur multiple times. It is application-specific how to update multiple instances of the same elements.

3.1.1Generator

The <meta:generator> element contains a string that identifies the application or tool that was used to create or last modify the XML document. This string should match the definition for user-agents in the HTTP protocol a specified in section 14.43 of [RFC2616]. The generator string should allow product versions to differ between all released versions of a user agent, for instance by including build ids or patch level information.

Conforming applications may use the generator string to work around bugs that exist or existed in certain applications, but shall not deliberately implement a different behavior depending on a certain generator string.

If the application that created the document could not provide an identifier string, the application does not export this element. If another application modifies the document and it cannot provide a unique identifier, it shall not export the original identifier belonging to the application that created the document.

<define name="office-meta-data" combine="choice">

<element name="meta:generator">

<ref name="string"/>

</element>

</define>

3.1.2Title

The <dc:title> element specifies the title of the document.

<define name="office-meta-data" combine="choice">

<element name="dc:title">

<ref name="string"/>

</element>

</define>

3.1.3Description

The <dc:description> element contains a brief description of the document.

<define name="office-meta-data" combine="choice">

<element name="dc:description">

<ref name="string"/>

</element>

</define>

3.1.4Subject

The <dc:subject> element specifies the subject of the document.

<define name="office-meta-data" combine="choice">

<element name="dc:subject">

<ref name="string"/>

</element>

</define>

3.1.5Keywords

The <meta:keyword> element contains a keyword pertaining to the document. The metadata can contain any number of <meta:keyword> elements, each element specifying one keyword.

<define name="office-meta-data" combine="choice">

<element name="meta:keyword">

<ref name="string"/>

</element>

</define>

3.1.6Initial Creator

The <meta:initial-creator> element specifies the name of the person who created the document initially.

<define name="office-meta-data" combine="choice">

<element name="meta:initial-creator">

<ref name="string"/>

</element>

</define>

3.1.7Creator

The <dc:creator> element specifies the name of the person who last modified the document. The name of this element was chosen for compatibility with the Dublin Core, but this definition of "creator" used here differs from Dublin Core, which defines creator as "An entity primarily responsible for making the content of the resource." In OpenDocument terminology, the last person to modify the document is primarily responsible for making the content of the document.

<define name="office-meta-data" combine="choice">

<ref name="dc-creator"/>

</define>

<define name="dc-creator">

<element name="dc:creator">

<ref name="string"/>

</element>

</define>

3.1.8Printed By

The <meta:printed-by> element specifies the name of the last person who printed the document.

<define name="office-meta-data" combine="choice">

<element name="meta:printed-by">

<ref name="string"/>

</element>

</define>

3.1.9Creation Date and Time

The <meta:creation-date> element specifies the date and time when the document was created initially.

To conform with [xmlschema-2], the date and time format is YYYY-MM-DDThh:mm:ss.

<define name="office-meta-data" combine="choice">

<element name="meta:creation-date">

<ref name="dateTime"/>

</element>

</define>

3.1.10Modification Date and Time

The <dc:date> element specifies the date and time when the document was last modified.

To conform with [xmlschema-2], the date and time format is YYYY-MM-DDThh:mm:ss.

The name of this element was chosen for compatibility with the Dublin Core.

<define name="office-meta-data" combine="choice">

<ref name="dc-date"/>

</define>

<define name="dc-date">

<element name="dc:date">

<ref name="dateTime"/>

</element>

</define>

3.1.11Print Date and Time

The <meta:print-date> element specifies the date and time when the document was last printed.

To conform with [xmlschema-2], the date and time format is YYYY-MM-DDThh:mm:ss.

<define name="office-meta-data" combine="choice">

<element name="meta:print-date">

<ref name="dateTime"/>

</element>

</define>

3.1.12Document Template

The <meta:template> element contains a URL for the document template that was used to create the document. The URL is specified as an XLink.

This element conforms to the XLink Specification. See [XLink].

The attributes that may be associated with the <meta:template> element are:

Template Location

An xlink:href attribute specifies the location of the document template.

Template Title

The xlink:title attribute specifies the name of the document template.

Template Modification Date and Time

The meta:date attribute specifies the date and time when the template was last modified, prior to being used to create the current document.

To conform with [xmlschema-2], the date and time format is YYYY-MM-DDThh:mm:ss.

<define name="office-meta-data" combine="choice">

<element name="meta:template">

<attribute name="xlink:href">

<ref name="anyURI"/>

</attribute>

<optional>

<attribute name="xlink:type" a:defaultValue="simple">

<value>simple</value>

</attribute>

</optional>

<optional>

<attribute name="xlink:actuate" a:defaultValue="onRequest">

<value>onRequest</value>

</attribute>

</optional>

<optional>

<attribute name="xlink:title">

<ref name="string"/>

</attribute>

</optional>

<optional>

<attribute name="meta:date">

<ref name="dateTime"/>

</attribute>

</optional>

</element>

</define>

3.1.13Automatic Reload

The <meta:auto-reload> element specifies whether a document is reloaded or replaced by another document after a certain period of time has elapsed.

The attributes that may be associated with the <meta:auto-reload> element are:

Reload URL

If a loaded document should be replaced by another document after a certain period of time, the <meta:auto-reload> element is presented as an XLink. An xlink:href attribute identifies the URL of the replacement document.

Reload Delay

The meta:delay attribute specifies the reload delay.

To conform with the duration data type of [xmlschema-2], the format of the value of this attribute is PnYnMnDTnHnMnS. See §3.2.6 of [xmlschema-2] for more detailed information on this duration format.

<define name="office-meta-data" combine="choice">

<element name="meta:auto-reload">

<optional>

<attribute name="xlink:type" a:defaultValue="simple">

<value>simple</value>

</attribute>

</optional>

<optional>

<attribute name="xlink:show" a:defaultValue="replace">

<value>replace</value>

</attribute>

</optional>

<optional>

<attribute name="xlink:actuate" a:defaultValue="onLoad">

<value>onLoad</value>

</attribute>

</optional>

<optional>

<attribute name="xlink:href">

<ref name="anyURI"/>

</attribute>

</optional>

<optional>

<attribute name="meta:delay">

<ref name="duration"/>

</attribute>

</optional>

</element>

</define>

3.1.14Hyperlink Behavior

The <meta:hyperlink-behaviour> element specifies the default behavior for hyperlinks in the document.

The only attribute that may be associated with the <meta:hyperlink-behaviour> element is:

Target Frame

The meta:target-frame-name attribute specifies the name of the default target frame in which to display a document referenced by a hyperlink.

This attribute can have one of the following values:

To conform with the XLink Specification, an additional xlink:show attribute is attached to the <meta:hyperlink-behaviour> element. If the value of the meta:target-frame-name attribute is _blank, the xlink:show attribute value is new. If the value of the meta:target-frame-name attribute is any of the other value options, the value of the xlink:show attribute is replace.

<define name="office-meta-data" combine="choice">

<element name="meta:hyperlink-behaviour">

<optional>

<attribute name="office:target-frame-name">

<ref name="targetFrameName"/>

</attribute>

</optional>

<optional>

<attribute name="xlink:show">

<choice>

<value>new</value>

<value>replace</value>

</choice>

</attribute>

</optional>

</element>

</define>

3.1.15Language

The <dc:language> element specifies the default language of the document.

The manner in which the language is represented is similar to the language tag described in [RFC3066]. It consists of a two or three letter Language Code taken from the ISO 639 standard optionally followed by a hyphen (-) and a two-letter Country Code taken from the ISO 3166 standard.

<define name="office-meta-data" combine="choice">

<element name="dc:language">

<ref name="language"/>

</element>

</define>

3.1.16Editing Cycles

The <meta:editing-cycles> element specifies the number of editing cycles the document has been through.

The value of this element is incremented every time the document is saved. The element contains the number of editing cycles as text.

<define name="office-meta-data" combine="choice">

<element name="meta:editing-cycles">

<ref name="nonNegativeInteger"/>

</element>

</define>

3.1.17Editing Duration

The <meta:editing-duration> element specifies the total time spent editing the document.

The duration is represented in the duration data type of [xmlschema-2], that is PnYnMnDTnHnMnS. See §3.2.6 of [xmlschema-2] for more detailed information on this duration format.

<define name="office-meta-data" combine="choice">

<element name="meta:editing-duration">

<ref name="duration"/>

</element>

</define>

3.1.18Document Statistics

The <meta:document-statistic> element specifies the statistics of the document, for example, the page count, word count, and so on. The statistics are specified as attributes of the <meta:document-statistic> element and the statistics that are exported with the document depend on the document type and the application used to create the document.

Document Type

Document Statistics Attributes

Text

meta:page-count
meta:table-count
meta:draw-count
meta:image-count
meta:ole-object-count
meta:paragraph-count

meta:word-count
meta:character-count
meta:row-count
meta:frame-count
meta:sentence-count
meta:syllable-count
meta:non-whitespace-character-count

Spreadsheet

meta:page-count
meta:table-count
meta:image-count
meta:cell-count
meta:object-count

Graphic

meta:page-count
meta:image-count
meta:object-count

<define name="office-meta-data" combine="choice">

<element name="meta:document-statistic">

<optional>

<attribute name="meta:page-count">

<ref name="nonNegativeInteger"/>

</attribute>

</optional>

<optional>

<attribute name="meta:table-count">

<ref name="nonNegativeInteger"/>

</attribute>

</optional>

<optional>

<attribute name="meta:draw-count">

<ref name="nonNegativeInteger"/>

</attribute>

</optional>

<optional>

<attribute name="meta:image-count">

<ref name="nonNegativeInteger"/>

</attribute>

</optional>

<optional>

<attribute name="meta:ole-object-count">

<ref name="nonNegativeInteger"/>

</attribute>

</optional>

<optional>

<attribute name="meta:paragraph-count">

<ref name="nonNegativeInteger"/>

</attribute>

</optional>

<optional>

<attribute name="meta:word-count">

<ref name="nonNegativeInteger"/>

</attribute>

</optional>

<optional>

<attribute name="meta:character-count">

<ref name="nonNegativeInteger"/>

</attribute>

</optional>

<optional>

<attribute name="frame-count">

<ref name="nonNegativeInteger"/>

</attribute>

</optional>

<optional>

<attribute name="sentence-count">

<ref name="nonNegativeInteger"/>

</attribute>

</optional>

<optional>

<attribute name="syllable-count">

<ref name="nonNegativeInteger"/>

</attribute>

</optional>

<optional>

<attribute name="non-whitespace-character-count">

<ref name="nonNegativeInteger"/>

</attribute>

</optional>

<optional>

<attribute name="meta:row-count">

<ref name="nonNegativeInteger"/>

</attribute>

</optional>

<optional>

<attribute name="meta:cell-count">

<ref name="nonNegativeInteger"/>

</attribute>

</optional>

<optional>

<attribute name="meta:object-count">

<ref name="nonNegativeInteger"/>

</attribute>

</optional>

</element>

</define>



3.2User-defined Metadata

The <meta:user-defined> element specifies any additional user-defined metadata for the document. Each instance of this element can contain one piece of user-defined metadata. The element contains:

The default type for meta-data elements is string.

<define name="office-meta-data" combine="choice">

<element name="meta:user-defined">

<attribute name="meta:name">

<ref name="string"/>

</attribute>

<choice>

<group>

<attribute name="meta:value-type">

<value>float</value>

</attribute>

<ref name="double"/>

</group>

<group>

<attribute name="meta:value-type">

<value>date</value>

</attribute>

<ref name="dateOrDateTime"/>

</group>

<group>

<attribute name="meta:value-type">

<value>time</value>

</attribute>

<ref name="duration"/>

</group>

<group>

<attribute name="meta:value-type">

<value>boolean</value>

</attribute>

<ref name="boolean"/>

</group>

<group>

<attribute name="meta:value-type">

<value>string</value>

</attribute>

<ref name="string"/>

</group>

<text/>

</choice>

</element>

</define>

3.3Custom Metadata

In addition to the pre-defined metadata elements, applications should also preserve any additional content found inside the <office:meta> element. As there is no semantics specified for such foreign content, applications need not process this information other than to preserve it when editing the document.

4Text Content

4.1Headings, Paragraphs and Basic Text Structure

This section describes the XML elements and attributes that are used to represent heading and paragraph components in a text document.

The elements <text:h>and <text:p>represent headings and paragraphs, respectively, and are collectively referred to as paragraph elements. All text content in an OpenDocument file must be contained in either of these elements.

4.1.1Headings

Headings define the chapter structure for a document. A chapter or subchapter begins with a heading and extends to the next heading at the same or higher level.

<define name="text-h">

<element name="text:h">

<ref name="heading-attrs"/>

<ref name="paragraph-attrs"/>

<optional>

<ref name="text-number"/>

</optional>

<zeroOrMore>

<ref name="paragraph-content"/>

</zeroOrMore>

</element>

</define>

Heading Level

The text:outline-level attribute associated with the heading element determines the level of the heading, starting with 1. Headings without a level attribute are assumed to be at level 1.

<define name="heading-attrs" combine="interleave">

<attribute name="text:outline-level">

<ref name="positiveInteger"/>

</attribute>

</define>

Heading Numbering

Header numbering can be changed by additional attributes, similar to those on list items (see section 4.3.2, below). The numbering of headers can be restarted by setting the text:restart-numbering attribute to true.

<define name="heading-attrs" combine="interleave">

<optional>

<attribute name="text:restart-numbering" a:defaultValue="false">

<ref name="boolean"/>

</attribute>

</optional>

</define>

Start Value

The attribute text:start-value may be used to restart the numbering of headers of the current header's level, by setting a new value for the numbering.

<define name="heading-attrs" combine="interleave">

<optional>

<attribute name="text:start-value">

<ref name="nonNegativeInteger"/>

</attribute>

</optional>

</define>

Suppress Header Numbering

It is sometimes desired to have a specific heading which should not be numbered. This corresponds to unnumbered list headers in lists (see sections 4.3). To facilitate this, an optional attribute text:is-list-header can be used. If true, the given header will not be numbered, even if an explicit list-style is given.

<define name="heading-attrs" combine="interleave">

<optional>

<attribute name="text:is-list-header" a:defaultValue="false">

<ref name="boolean"/>

</attribute>

</optional>

</define>

Formatted Heading Number

If a heading has a numbering applied, the text of the formatted number can be included in a <text:number> element. This text can be used by applications that do not support numbering of headings, but it will be ignored by applications that support numbering.

<define name="text-number">

<element name="text:number">

<ref name="string"/>

</element>

</define>

4.1.2Paragraphs

Paragraphs are the basic unit of text.

<define name="text-p">

<element name="text:p">

<ref name="paragraph-attrs"/>

<zeroOrMore>

<ref name="paragraph-content"/>

</zeroOrMore>

</element>

</define>

4.1.3Common Paragraph Elements Attributes

The paragraph elements have text:style-name, text:class-names and text:cond-style-name attributes. These attributes must reference paragraph styles.

A text:style-name attribute references a paragraph style, while a text:cond-style-name attribute references a conditional-style, that is, a style that contains conditions and maps to other styles (see section 14.1.1). If a conditional style is applied to a paragraph, the text:style-name attribute contains the name of the style that was the result of the conditional style evaluation, while the conditional style name itself is the value of the text:cond-style-name attribute. This XML structure simplifies [XSLT] transformations because XSLT only has to acknowledge the conditional style if the formatting attributes are relevant. The referenced style can be a common style or an automatic style.

A text:class-names attribute takes a whitespace separated list of paragraph style names. The referenced styles are applied in the order they are contained in the list. If both, text:style-name and text:class-names are present, the style referenced by the text:style-name attribute is as the first style in the list in text:class-names. If a conditional style is specified together with a style:class-names attribute, but without the text:style-name attribute, then the first style in the style list is used as the value of the missing text:style-name attribute.

Conforming applications should support the text:class-names attribute and also should preserve it while editing.

<define name="paragraph-attrs">

<optional>

<attribute name="text:style-name">

<ref name="styleNameRef"/>

</attribute>

</optional>

<optional>

<attribute name="text:class-names">

<ref name="styleNameRefs"/>

</attribute>

</optional>

<optional>

<attribute name="text:cond-style-name">

<ref name="styleNameRef"/>

</attribute>

</optional>

</define>

Example: Styles and conditional styles

<text:p text:style-name="Heading 1">

"Heading 1" is not a conditional style.

</text:p>

<text:p text:style-name="Numbering 1" text:cond-style-name="Text body">

"Text body" is a conditional style. If it is contained in a numbered

paragraph, it maps to "Numbering 1". This is assumed in this example.

</text:p>

A paragraph may have an ID. This ID can be used to reference the paragraph from other elements.

<define name="paragraph-attrs" combine="interleave">

<optional>

<ref name="text-id"/>

</optional>

</define>

4.2Page Sequences

A page sequence element <text:page-sequence> specifies a sequence of master pages that are instantiated in exactly the same order as they are referenced in the page sequence. If a text document contains a page sequence, it will consist of exactly as many pages as specified. Documents with page sequences do not have a main text flow consisting of headings and paragraphs as is the case for documents that do not contain a page sequence. Text content is included within text boxes for documents with page sequences. The only other content that is permitted are drawing objects.

Example: Page Sequence

<style:automatic-style>

<style:page-layout name="pm1">

<!-- portrait page -->

</style:page-layout>

<style:page-layout name="pm2">

<!-- landscape page -->

</style:page-layout>

</style:automatic-style>

...

<style:master-styles>

<style:master-page name="portrait" style:page-layout-name="pm1"/>

<style:master-page name="landscape" style:page-layout-name="pm2"/>

</style:master-styles>

...

<office:body>

<text:page-sequence>

<text:page text:master-page-name="portrait"/>

<text:page text:master-page-name="portrait"/>

<text:page text:master-page-name="landscape"/>

<text:page text:master-page-name="landscape"/>

<text:page text:master-page-name="portrait"/>

</text:page-sequence>

<draw:frame ...>

<draw:text-box ...>

<text:p>Example text.</text:p>

...

</draw:text-box>

</draw:frame>

</office:body>

<define name="text-page-sequence">

<element name="text:page-sequence">

<oneOrMore>

<ref name="text-page"/>

</oneOrMore>

</element>

</define>

4.2.1Page

The <text:page> element specifies a single page within a page sequence.

<define name="text-page">

<element name="text:page">

<ref name="text-page-attlist"/>

<empty/>

</element>

</define>

Master Page Name

The text:master-page-name attribute specifies the master page that is instantiated.

<define name="text-page-attlist">

<attribute name="text:master-page-name">

<ref name="styleNameRef"/>

</attribute>

</define>

4.3Lists

The OpenDocument format supports list structures, similar to those found in [HTML4]. A list is a paragraph-level element, which contains an optional list header, followed by a sequence of list items. The list header and each list item contains a sequence of paragraph or list elements. Lists can be nested.

Lists may be numbered. The numbering may be restarted with a specific numbering at each list item. Lists may also continue numbering from other lists, allowing the user to merge several lists into a single, discontinuous list. Note that whether the list numbering is displayed depends on a suitable list style being used.

In addition to this structural information, lists can have list styles associated with them, which contain the relevant layout information, such as

4.3.1List Block

A list is represented by the <text:list> element. It contains an optional list header, followed by any number of list items.

Every list has a list level, which is determined by the nesting of the <text:list> elements. If a list is not contained within another list, the list level is 1. If the list in contained within another list, the list level is the list level of the list in which is it contained incremented by one. If a list is contained in a table cell or text box, the list level returns to 1, even though the table or textbox itself may be nested within another list.

The attributes that may be associated with the list element are:

<define name="text-list">

<element name="text:list">

<ref name="text-list-attr"/>

<optional>

<ref name="text-list-header"/>

</optional>

<zeroOrMore>

<ref name="text-list-item"/>

</zeroOrMore>

</element>

</define>

Style Name

The optional text:style-name attribute specifies the name of the list style that is applied to the list.

If this attribute is not included and therefore no list style is specified, one of the following actions is taken:

To determine which formatting properties are applied to a list, the list level and list style name are taken into account. See section 14.10 for more information on list formatting properties.

<define name="text-list-attr" combine="interleave">

<optional>

<attribute name="text:style-name">

<ref name="styleNameRef"/>

</attribute>

</optional>

</define>

Continue Numbering

By default, the first list item in a list starts with the number specified in the list style. The continue numbering attribute can be used to continue the numbering from the preceding list.

This attribute can be used with the <text:list> element and can have a value of true or false.

If the value of the attribute is true and the numbering style of the preceding list is the same as the current list, the number of the first list item in the current list is the number of the last item in the preceding list incremented by one.

<define name="text-list-attr" combine="interleave">

<optional>

<attribute name="text:continue-numbering">

<ref name="boolean"/>

</attribute>

</optional>

</define>

4.3.2List Item

List items contain the textual content of a list. A <text:list-item> element can contain paragraphs or lists. A list item cannot contain headings or tables.

<define name="text-list-item">

<element name="text:list-item">

<ref name="text-list-item-attr"/>

<ref name="text-list-item-content"/>

</element>

</define>

<define name="text-list-item-content">

<optional>

<ref name="text-number"/>

</optional>

<zeroOrMore>

<choice>

<ref name="text-p"/>

<ref name="text-h"/>

<ref name="text-list"/>

</choice>

</zeroOrMore>

</define>

The first line in a list item is preceded by a bullet or number, depending on the list style assigned to the list. If a list item starts another list immediately and does not contain any text, no bullet or number is displayed.

The only attribute that may be associated with the <text:list-item> element is:

Start Value

The numbering of the current list can be restarted at a certain number. The text:start-value attribute is used to specify the number with which to restart the list.

This attribute can only be applied to items in a list with a numbering list style. It restarts the numbering of the list at the current item.

<define name="text-list-item-attr" combine="interleave">

<optional>

<attribute name="text:start-value">

<ref name="nonNegativeInteger"/>

</attribute>

</optional>

</define>

Formatted Number

If a list item has a numbering applied, the text of the formatted number can be included in a <text:number> element. This text can be used by applications that do not support numbering, but it will be ignored by applications that support numbering. See also section 4.1.1.

Example: Lists and sublists

<text:list text:style-name="List 1">

<text:list-item>

<text:p>This is the first list item</text:p>

<text:p>This is a continuation of the first list item.</text:p>

</text:list-item>

<text:list-item>

<text:p>This is the second list item.

It contains a sub list.</text:p>

<text:list>

<text:list-item><text:p>This is a sub list item.</text:p>

<text:list-item><text:p>This is a sub list item.</text:p>

<text:list-item><text:p>This is a sub list item.</text:p>

</text:list>

</text:list-item>

<text:list-item>

<text:p>This is the third list item</text:p>

</text:list-item>

</text:list>

4.3.3List Header

A list header is a special kind of list item. It contains one or more paragraphs that are displayed before a list. The paragraphs are formatted like list items but they do not have a preceding number or bullet. The list header is represented by the list header element.

<define name="text-list-header">

<element name="text:list-header">

<ref name="text-list-item-content"/>

</element>

</define>

4.3.4Numbered Paragraphs

In some instances, it is desirable to specify a list not as a structural element comprising of several list items, but to determine on a per-paragraph level whether the paragraph is numbered, and at which level. To facilitate this, the <text:numbered-paragraph> element allows the numbering of an individual paragraph, as if it was part of a list at a specified level.

Numbered paragraphs may use the same continuous numbering properties that list items use, and thus form an equivalent, alternative way of specifying lists. A list in <text:list> representation could be converted into a list in <text:numbered-paragraph> representation and vice versa.

<define name="text-numbered-paragraph">

<element name="text:numbered-paragraph">

<ref name="text-numbered-paragraph-attr"/>

<optional>

<ref name="text-number"/>

</optional>

<choice>

<ref name="text-p"/>

<ref name="text-h"/>

</choice>

</element>

</define>

A numbered paragraph can be assigned a list level. A numbered paragraph is equivalent to a list nested to the given level, containing one list item with one paragraph. If no level is given, the numbered paragraph is interpreted as being on level 1.

<define name="text-numbered-paragraph-attr" combine="interleave">

<optional>

<attribute name="text:level" a:defaultValue="1">

<ref name="positiveInteger"/>

</attribute>

</optional>

</define>

As a numbered paragraph combines the functionality of a (possibly nested) list with a single list item, it can also use the attributes of those elements.

<define name="text-numbered-paragraph-attr" combine="interleave">

<ref name="text-list-attr"/>

</define>

<define name="text-numbered-paragraph-attr" combine="interleave">

<ref name="text-list-item-attr"/>

</define>

The text of a formatted number can be included in a <text:number> element. This text can be used by applications that do not support numbering, but it will be ignored by applications that support numbering. See also section 4.1.1.

4.4Text Sections

A text section is a named region of paragraph-level text content. Sections start and end on paragraph boundaries and can contain any number of paragraphs.

Sections have two uses in the OpenDocument format: They can be used to assign certain formatting properties to a region of text. They can also be used to group text that is automatically acquired from some external data source.

In addition to Sections can contain regular text content or the text can be contained in another file and linked to the section. Sections can also be write-protected or hidden.

Sections can have settings for text columns, background color or pattern, and notes configuration. These settings form the section style, which is represented in a <style:style> element. See section 14.8.3 for details.

The formatting properties for sections are explained in section 15.7.

Sections support two ways of linking to external content. If a section is linked to another document, the link can be through one of the following:

Linking information for external content is contained in the section element's first child. A section that links to external content contains the full representation of the data source, so that processors need to understand the linking information only if they wish to update the contents of the section.

<define name="text-section">

<element name="text:section">

<ref name="text-section-attr"/>

<choice>

<ref name="text-section-source"/>

<ref name="text-section-source-dde"/>

<empty/>

</choice>

<zeroOrMore>

<ref name="text-content"/>

</zeroOrMore>

</element>

</define>

Note: List items may not contain sections. Thus, lists may only be wholly contained within section elements. If it is desired to achieve the effect of overlapping lists and sections, or of sections contained within lists, the lists must be split into several lists, each of which would then be wholly contained within a section. When splitting the list, suitable attributes for continuous numbering should be set such that display and behavior are the same as with the original list not interrupted by sections.

4.4.1Section Attributes

Text indices, described in chapter 7, may be considered a special kind of text section, as they share the same general structure as well as certain attributes. These are combined in the following definition:

<define name="text-section-attr" combine="interleave">

<ref name="sectionAttr"/>

</define>

The remaining attributes in this section are specific to the <text:section> element.

Section Style

The text:style-name attribute refers to a section style.

<define name="sectionAttr" combine="interleave">

<optional>

<attribute name="text:style-name">

<ref name="styleNameRef"/>

</attribute>

</optional>

</define>

Section Name

Every section must have a name that uniquely identifies the section. The text:name attribute contains the name of the section.

<define name="sectionAttr" combine="interleave">

<attribute name="text:name">

<ref name="string"/>

</attribute>

</define>

Protected Sections

A section can be protected, which means that a user can not edit the section. The text:protected attribute indicates whether or not a section is protected. The user interface must enforce the protection attribute if it is enabled.

<define name="sectionAttr" combine="interleave">

<optional>

<attribute name="text:protected">

<ref name="boolean"/>

</attribute>

</optional>

</define>

A user can use the user interface to reset the protection flag, unless the section is further protected by a password. In this case, the user must know the password in order to reset the protection flag. The text:protection-key attribute specifies the password that protects the section. To avoid saving the password directly into the XML file, only a hash value of the password is stored.

<define name="sectionAttr" combine="interleave">

<optional>

<attribute name="text:protection-key">

<ref name="string"/>

</attribute>

</optional>

</define>

Hidden Sections and Conditional Sections

Sections can be hidden based on a condition or they can be hidden unconditionally.

The text:display attribute specifies whether or not the section is hidden. The value of this attribute can be:

The text:condition attribute specifies the condition under which the section is hidden. The condition is encoded as a string. If the value of text:display is condition, the text:condition attribute must be present.

<define name="text-section-attr" combine="interleave">

<choice>

<attribute name="text:display">

<choice>

<value>true</value>

<value>none</value>

</choice>

</attribute>

<group>

<attribute name="text:display">

<value>condition</value>

</attribute>

<attribute name="text:condition">

<ref name="string"/>

</attribute>

</group>

<empty/>

</choice>

</define>

4.4.2Section Source

The <text:section-source> element indicates that the enclosed section is a linked section. If this element is used, it must be the first element in the <text:section> element.

<define name="text-section-source">

<element name="text:section-source">

<ref name="text-section-source-attr"/>

</element>

</define>

The attributes that may be associated with the <text:section-source> attribute are:

Section Source URL

These attributes identify the document or section to which the section is linked. The name of the target section is identified by the local part of the URL, following the hash mark. The xlink:href attribute is implied because <text:section-source> elements may also link to internal sections.

<define name="text-section-source-attr" combine="interleave">

<optional>

<attribute name="xlink:href">

<ref name="anyURI"/>

</attribute>

<optional>

<attribute name="xlink:type" a:defaultValue="simple">

<value>simple</value>

</attribute>

</optional>

<optional>

<attribute name="xlink:show" a:defaultValue="embed">

<value>embed</value>

</attribute>

</optional>

</optional>

</define>

Name of Linked Section

If the link targets a section of a document, the attribute text:section name contains the name of the target section. If the attribute is not present, the link targets the entire document.

<define name="text-section-source-attr" combine="interleave">

<optional>

<attribute name="text:section-name">

<ref name="string"/>

</attribute>

</optional>

</define>

Filter Name

The text:filter-name attribute specifies which filter type was used to import the link target. The value of this attribute is implementation dependent.

<define name="text-section-source-attr" combine="interleave">

<optional>

<attribute name="text:filter-name">

<ref name="string"/>

</attribute>

</optional>

</define>

4.4.3DDE Source

If sections are linked via DDE, their linking information is represented by <office:dde-source> elements. It contains attributes that specify the application, topic and item of the DDE connection. Note that because the section contains the XML rendition of the DDE link's content, this information only needs to be processed if updated data from the DDE link are desired.

<define name="text-section-source-dde">

<ref name="office-dde-source"/>

</define>

4.5Page-bound graphical content

Within text documents, images, embedded objects and other drawing objects appear at the level of a paragraph if they are anchored to a page rather than to a paragraph or a character position within a paragraph. See section 9.2 for details on drawing objects, and section 9.2.16 for their anchoring.

4.6Change Tracking

This section describes how changes in text documents can be represented.

4.6.1Tracked Changes

All tracked changes to text documents are stored in a list. The list contains an element for each change made to the document. If the <text:tracked-changes> element is absent, change tracking is not enabled.

<define name="text-tracked-changes">

<optional>

<element name="text:tracked-changes">

<ref name="text-tracked-changes-attr"/>

<zeroOrMore>

<ref name="text-changed-region"/>

</zeroOrMore>

</element>

</optional>

</define>

Track Changes

This attribute determines whether or not user agents should track and record changes for this document.

<define name="text-tracked-changes-attr" combine="interleave">

<optional>

<attribute name="text:track-changes" a:defaultValue="true">

<ref name="boolean"/>

</attribute>

</optional>

</define>

4.6.2Changed Regions

For every changed region of a document, there is one entry in the list of tracked changes. This entry contains a list of all changes that were applied to the region. The start and end of this region are marked by the start and end elements that are described in the next section.

<define name="text-changed-region">

<element name="text:changed-region">

<ref name="text-changed-region-attr"/>

<ref name="text-changed-region-content"/>

</element>

</define>

Change ID

Every element has an ID. The elements that mark the start and end of a region use this ID to identify the region to which they belong.

<define name="text-changed-region-attr" combine="interleave">

<attribute name="text:id">

<ref name="ID"/>

</attribute>

</define>

4.6.3Insertion

The <text:insertion> element contains the information that is required to identify any insertion of content. This content can be a piece of text within a paragraph, a whole paragraph, or a whole table. The inserted content is part of the text document itself and is marked by a change start and a change end element.

<define name="text-changed-region-content" combine="choice">

<element name="text:insertion">

<ref name="office-change-info"/>

</element>

</define>

Example: Insertion of text

<text:tracked-changes>

<text:changed-region text:id="c001">

<text:insertion>

<office:change-info>

<dc:creator>Michael Brauer</dc:creator>

<dc:date>1999-05-18T12:56:04</dc:date>

</office:change-info>

</text:insertion>

</text:changed-region>

</text:tracked-changes>


<text:p>

This is the original text<text:change-start text:change-id="c001"/>,

but this has been added<text:change-end text:change-id="c001"/>.

</text:p>

4.6.4Deletion

A <text:deletion> element contains content that was deleted while change tracking was enabled. The position where the text was deleted is marked by the change position element.

If part of a paragraph was deleted, the text that was deleted is contained in this element as a paragraph element. If the deleted text is reinserted into the document, the paragraph is joined with the paragraph where the deletion took place.

<define name="text-changed-region-content" combine="choice">

<element name="text:deletion">

<ref name="office-change-info"/>

<zeroOrMore>

<ref name="text-content"/>

</zeroOrMore>

</element>

</define>

Example: Deletion of text

<text:tracked-changes>

<text:changed-region text:id="c002">

<text:deletion>

<office:change-info>

<dc:creator>Michael Brauer</dc:creator>

<dc:date>1999-05-18T12:56:04</dc:date>

</office:change-info>

<text:p>, but this has been deleted</text:p>

</text:deletion>

</text:changed-region>

</text:tracked-changes>


<text:p>

This is the original text<text:change text:region-id="c002"/>.

</text:p>

This example shows:

Note that the deleted text, like all text in the OpenDocument format, is contained in a paragraph element. To reconstruct the original text, this paragraph is merged with its surrounding. In other words, a deletion consisting of only a single word would be represented as a paragraph containing the word.

To reconstruct the text before the deletion took place, do:

Example: Given the following change:

<text:changed-region text:id="example">

<text:deletion>

<office:change-info>...</office:change-info>

<text:p>Hello</text:p>

<text:p>World!</text:p>

</text:deletion>

</text:changed-region>

The first (and most common) case occurs if a change mark is inside a regular paragraph:

<text:p>abc<text:change text:id="example/>def</text:p>

To reconstruct the original text, the two <text:p> elements are copied to replace the change mark, except the beginning and ending tags are missing:

<text:p>abcHello</text:p>

<text:p>World!def</text:p>

If the change mark occurred inside a header, the same procedure is followed, except the copied tags are adapted to make sure we still have well-formed XML.

<text:h>abc<text:change text:id="example/>def</text:h>

becomes:

<text:h>abcHello</text:h>

<text:h>World!def</text:h>

The third case occurs when a change occurs outside of a paragraph. In this case, the deleted text is simply copied verbatim.

<text:p>abcdef</text:p>

<text:change text:id="example/>

<text:p>ghijkl</text:p>

This becomes:

<text:p>abcdef</text:p>

<text:h>Hello</text:h>

<text:h>World!</text:h>

<text:p>ghijkl</text:p>

If, in the first two cases, the deletion contains complete paragraphs, then additional empty paragraphs must be put into the <text:deletion> element to achieve the desired result.

The change that took place from

<text:p>abc</text:p>

<text:h>Hello</text:h>

<text:h>World!</text:h>

<text:p>def</text:p>

to

<text:p>abc<text:change text:id="example/>def</text:p>

would be represented as:

<text:changed-region text:id="example">

<text:deletion>

<office:change-info>...</office:change-info>

<text:p/>

<text:p>Hello</text:p>

<text:p>World!</text:p>

<text:p/>

</text:deletion>

</text:changed-region>

4.6.5Format Change

A format change element represents any change in formatting attributes. The region where the change took place is marked by a change start and a change end element.

<define name="text-changed-region-content" combine="choice">

<element name="text:format-change">

<ref name="office-change-info"/>

</element>

</define>

Note: A format change element does not contain the actual changes that took place.

4.6.6Change Info

The change info element contains meta information who made the change and when. It is also used for spreadsheet documents, and thus described in a section 12.3 (Change Tracking Metadata).

4.6.7Change Marks

There are three elements that mark the start and the end of a changed region, as follows:

All three elements have an attribute that specifies the ID of the region to which they belong.

<define name="change-marks">

<choice>

<element name="text:change">

<ref name="change-mark-attr"/>

</element>

<element name="text:change-start">

<ref name="change-mark-attr"/>

</element>

<element name="text:change-end">

<ref name="change-mark-attr"/>

</element>

</choice>

</define>

<define name="change-mark-attr">

<attribute name="text:change-id">

<ref name="IDREF"/>

</attribute>

</define>

4.7Text Declarations

Several text elements need per-document declarations before they can be used. For example, variable fields require that the variables used are being declared at the beginning of the document. These declarations are collected at the beginning of a text document. All such declarations are optional. The detailed description for each declaration can be found in the appropriate chapter.

The supported text declarations are:

<define name="text-decls">

<optional>

<element name="text:variable-decls">

<zeroOrMore>

<ref name="text-variable-decl"/>

</zeroOrMore>

</element>

</optional>

<optional>

<element name="text:sequence-decls">

<zeroOrMore>

<ref name="text-sequence-decl"/>

</zeroOrMore>

</element>

</optional>

<optional>

<element name="text:user-field-decls">

<zeroOrMore>

<ref name="text-user-field-decl"/>

</zeroOrMore>

</element>

</optional>

<optional>

<element name="text:dde-connection-decls">

<zeroOrMore>

<ref name="text-dde-connection-decl"/>

</zeroOrMore>

</element>

</optional>

<optional>

<ref name="text-alphabetical-index-auto-mark-file"/>

</optional>

</define>

5Paragraph Elements Content

5.1Basic Text Content

Paragraph element's children make up the text content of any document. All text contained in a paragraph element or their children is text content, with few exceptions detailed later. This should significantly ease transformations into other formats, since transformations may ignore any child elements of paragraph elements and only process their text content, and still obtain a faithful representation of text content.

Text content elements that do not contain in-line text children are:

<define name="paragraph-content" combine="choice">

<text/>

</define>

5.1.1White-space Characters

If the paragraph element or any of its child elements contains white-space characters, they are collapsed, in other words they are processed in the same way that [HTML4] processes them. The following [UNICODE] characters are normalized to a SPACE character:

In addition, these characters are ignored if the preceding character is a white-space character. The preceding character can be contained in the same element, in the parent element, or in the preceding sibling element, as long as it is contained within the same paragraph element and the element in which it is contained processes white-space characters as described above.

White-space processing takes place within the following elements:

Note: In [XSL], white-space processing of a paragraph of text can be enabled by attaching an fo:white-space="collapse" attribute to the <fo:block> element that corresponds to the paragraph element.

Space Character

In general, consecutive white-space characters in a paragraph are collapsed. For this reason, there is a special XML element used to represent the [UNICODE] character SPACE (0x0020).

This element uses an optional attribute called text:c to specify the number of SPACE characters that the element represents. A missing text:c attribute is interpreted as meaning a single SPACE character.

This element is required to represent the second and all following SPACE characters in a sequence of SPACE characters. It is not an error if the character preceding the element is not a white-space character, but it is good practice to use this element for the second and all following SPACE characters in a sequence. This way, an application recognizes a single space character without recognizing this element.

<define name="paragraph-content" combine="choice">

<element name="text:s">

<optional>

<attribute name="text:c">

<ref name="nonNegativeInteger"/>

</attribute>

</optional>

</element>

</define>

Tab Character

The <text:tab> element represents the [UNICODE] tab character HORIZONTAL TABULATION (0x0009) in a heading or paragraph. A <text:tab> element reserves space from the current position up to the next tab-stop, as defined in the paragraph's style information.

<define name="paragraph-content" combine="choice">

<element name="text:tab">

<ref name="text-tab-attr"/>

</element>

</define>

To determine which tab-stop a tab character will advance to requires layout information. To make it easier for non-layout oriented processors to determine this information, applications may generate a text:tab-ref attribute as a hint that associates a tab character with a tab-stop in the current paragraph style. It contains the number of the tab-stop that the tab character refers to. The position 0 has a special meaning and signifies the start margin of the paragraph.

<define name="text-tab-attr">

<optional>

<attribute name="text:tab-ref">

<ref name="nonNegativeInteger"/>

</attribute>

</optional>

</define>

Note: The text:tab-ref attribute is only a hint to help non-layout oriented processors to determine the tab/tab-stop association. Layout oriented processors should determine the tab positions solely based on the style information.

Line Breaks

The <text:line-break> element represents a line break in a heading or paragraph.

<define name="paragraph-content" combine="choice">

<element name="text:line-break">

<empty/>

</element>

</define>

5.1.2Soft Hyphens, Hyphens, and Non-breaking Blanks

Soft hyphens, hyphens, and non-breaking blanks are represented by [UNICODE] characters.

The [UNICODE] character...

Represents...

SOFT HYPHEN (00AD)

soft hyphens

NON-BREAKING HYPHEN (2011)

non-breaking hyphens

NO-BREAK SPACE (00A0)

non-breaking blanks

5.1.3Attributed Text

The <text:span> element represents portions of text that are attributed using a certain text style or class. The content of this element is the text that uses the text style.

The name of the a text style or text class is the value of a text:style-name or text:class-names attributes, respectively, attached to the <text:span> element. These attributes must refer to text styles or classes.

A text:style-name attribute references a single text style. A text:class-names attribute takes a whitespace separated list of text style names. The referenced text styles are applied in the order they are contained in the list. If both, text:style-name and text:class-names are present, the style referenced by the text:style-name attribute is treated as the first style in the list in text:class-names. Conforming application should support the text:class-names attribute and also should preserve it while editing.

<text:span> elements can be nested.

White-space characters contained in this element are collapsed.

<define name="paragraph-content" combine="choice">

<element name="text:span">

<optional>

<attribute name="text:style-name">

<ref name="styleNameRef"/>

</attribute>

</optional>

<optional>

<attribute name="text:class-names">

<ref name="styleNameRefs"/>

</attribute>

</optional>

<zeroOrMore>

<ref name="paragraph-content"/>

</zeroOrMore>

</element>

</define>

Example: Text style in OpenDocument documents:

<text:p>

The last word of this sentence is

<text:span text:style-name="emphasize">emphasized</text:span>.

</text:p>

5.1.4Hyperlinks

Hyperlinks in text documents are represented by a <text:a> element.

This element also contains an event table element, <office:event-listeners>, which contains the events assigned to the hyperlink. See section 12.4 for more information on the event table element.

<define name="paragraph-content" combine="choice">

<element name="text:a">

<ref name="text-a-attlist"/>

<optional>

<ref name="office-event-listeners"/>

</optional>

<zeroOrMore>

<ref name="paragraph-content"/>

</zeroOrMore>

</element>

</define>

The attributes that may be associated with the <text:a> element are:

Name

A hyperlink can have a name, but it is not essential. The office:name attribute specifies the name of the hyperlink if one exists. This name can serve as a target for some other hyperlinks.

<define name="text-a-attlist" combine="interleave">

<optional>

<attribute name="office:name">

<ref name="string"/>

</attribute>

</optional>

</define>

Link Location

The xlink:href attribute specifies the URL for the target location of the link.

<define name="text-a-attlist" combine="interleave">

<attribute name="xlink:href">

<ref name="anyURI"/>

</attribute>

<optional>

<attribute name="xlink:type" a:defaultValue="simple">

<value>simple</value>

</attribute>

</optional>

<optional>

<attribute name="xlink:actuate" a:defaultValue="onRequest">

<value>onRequest</value>

</attribute>

</optional>

</define>

Target Frame

The office:target-frame-nameattribute specifies the target frame of the link. This attribute can have one of the following values:

To conform with the XLink Specification, an additional xlink:show attribute is attached to the <text:a> element. If the value of the attribute is _blank, the xlink:show attribute value is new. If the value of the attribute is any of the other value options, the value of the xlink:show attribute is replace. See [XLink].

<define name="text-a-attlist" combine="interleave">

<optional>

<attribute name="office:target-frame-name">

<ref name="targetFrameName"/>

</attribute>

</optional>

<optional>

<attribute name="xlink:show">

<choice>

<value>new</value>

<value>replace</value>

</choice>

</attribute>

</optional>

</define>

Text Styles

Every hyperlink has two text styles as follows:

<define name="text-a-attlist" combine="interleave">

<optional>

<attribute name="text:style-name">

<ref name="styleNameRef"/>

</attribute>

</optional>

<optional>

<attribute name="text:visited-style-name">

<ref name="styleNameRef"/>

</attribute>

</optional>

</define>

5.2Bookmarks and References

5.2.1Bookmarks

Bookmarks can either mark a text position or a text range. A text range can start at any text position and end at another text position. In particular, a bookmark can start in the middle of one paragraph and end in the middle of another paragraph. The XML element used to represent a bookmark varies depending on the type of bookmark, as follows:

For every <text:bookmark-start> element, there must be a <text:bookmark-end> element in the same text flow using the same text:name attribute, and vice versa. The <text:bookmark-start> element must precede the <text:bookmark-end> element.

<define name="paragraph-content" combine="choice">

<choice>

<element name="text:bookmark">

<attribute name="text:name">

<ref name="string"/>

</attribute>

</element>

<element name="text:bookmark-start">

<attribute name="text:name">

<ref name="string"/>

</attribute>

</element>

<element name="text:bookmark-end">

<attribute name="text:name">

<ref name="string"/>

</attribute>

</element>

</choice>

</define>

Example: Bookmarks

<text:p>

<text:bookmark text:name="Mark 1"/>There is a text mark in front of this

paragraph.

<text:bookmark-start text:name="Mark 2"/>In front of this paragraph there is

the start of a bookmark.

</text:p>

<text:p>

This bookmark ends

<text:bookmark-end text:name="Mark 2"/>

amid this sentence.

</text:p>

5.2.2References

The representation of references is modeled on the XML representation of bookmarks. There are two types of reference marks, as follows:

Every reference is identified by its name, which must be unique. In a range reference, the start and end elements must use the same reference name.

Point References

The <text:reference-mark> element represents a point reference.

<define name="paragraph-content" combine="choice">

<element name="text:reference-mark">

<attribute name="text:name">

<ref name="string"/>

</attribute>

</element>

</define>

Range References

The <text:reference-mark-start> and <text:reference-mark-end> elements represent a range reference.

<define name="paragraph-content" combine="choice">

<choice>

<element name="text:reference-mark-start">

<attribute name="text:name">

<ref name="string"/>

</attribute>

</element>

<element name="text:reference-mark-end">

<attribute name="text:name">

<ref name="string"/>

</attribute>

</element>

</choice>

</define>

In the OpenDocument schema, three elements are used to represent references instead of one element because references represented as a single XML element:

Take the following example:

Example: Overlapping range references

<text:p>
<text:reference-
mark-start text:name="first"/>This is an

<text:reference-mark-start text:name="second"/>example of a sentence

<text:reference-mark-end text:name="first"/>with overlapping references.

<text:reference-mark-end text:name="second"/>
</text:p>

The example paragraph shows two references that cover the following text:

reference “first”

“This is an example of a sentence”

reference “second”

“example of a sentence with overlapping references.”

This overlapping structure cannot be represented using a single reference element to contain the referenced text. Similarly, a reference spanning multiple paragraphs creates the same situation as two overlapping XML elements, as does character formatting either starts or ends, but not both, within the referenced text.

5.3Notes

Notes consist of a <text:note> element which occurs in the text stream at the position to which the note is anchored. How notes are numbered and rendered is determined by <text:notes-configuration> element, which occurs inside the <office:styles> section.

5.3.1Note Element

The note element represents text notes which are attached to a certain text position. A common implementation of this concept are the footnotes and endnotes found in most word processors. A note contains a note citation element and a note body elements, which contains the note's content.

In OpenDocument documents, notes are represented in a similar fashion to footnotes in [XSL]. In XSL, the first child of the note element contains the citation in the form of an <fo:inline> element. The OpenDocument schema uses the same structure but introduces a <text:note-citation> element. The second child contains the note body, just as in XSL.

Additionally, OpenDocument features <text:notes-configuration> elements. To achieve a similar effect to the note configuration in XSL, every note citation element must be formatted appropriately.

<define name="paragraph-content" combine="choice">

<element name="text:note">

<ref name="text-note-class"/>

<optional>

<attribute name="text:id">

<ref name="string"/>

</attribute>

</optional>

<element name="text:note-citation">

<optional>

<attribute name="text:label">

<ref name="string"/>

</attribute>

</optional>

<text/>

</element>

<element name="text:note-body">

<zeroOrMore>

<ref name="text-content"/>

</zeroOrMore>

</element>

</element>

</define>

Note Class

Each note belongs to a class which determines how the note is expected to be rendered. Currently, two note classes are supported: Footnotes and endnotes.

<define name="text-note-class">

<attribute name="text:note-class">

<choice>

<value>footnote</value>

<value>endnote</value>

</choice>

</attribute>

</define>

Footnote Reference ID

The footnote reference ID is used by references to footnotes to identify the footnote that is referenced.

Note Citation Element

The <text:note-citation> element contains the formatted note citation element, either as a formatted number or a string.

Note Label

Note citation elements can be labeled or numbered. If they are numbered, the number is chosen and formatted automatically according to the notes configuration element. If they are labeled, the user must supply a label for every note he/she inserts into the document. This label is stored in the text:label attribute of the <text:note-citation> element.

Note Body

The <text:note-body> element contains the actual content of the footnote. It does not have any attributes.

The schema allows for the inclusion of notes into the note body. While this may be reasonable for some future note types, it is not reasonable for footnotes and endnotes. Conforming applications may or may not support such nested notes.

Footnote example

<text:p>

This paragraph contains a footnote

<text:note text:note-class="footnote" text:id="ftn001">

<text:note-citation>1</text:note-citation>

<text:note-body>

<text:p>

This footnote has a generated sequence number

</text:p>

</text:note-body>

</text:note>

.

</text:p>

<text:p>

This paragraph contains a footnote

<text:note text:note-class="footnote" text:id="ftn002">

<text:note-citation text:label="*">*</text:note-citation>

<text:note-body>

<text:p>

This footnote has a fixed citation

</text:p>

</text:note-body>

</text:note>

, too

</text:p>

5.4Ruby

A ruby is additional text that is displayed above or below some base text. The purpose of ruby is to annotate the base text or provide information about its pronunciation.

There are two elements that can be contained in the <text:ruby> element:

The <text:ruby-base> element contains the text that is to be annotated. It contains any paragraph element content, like text spans. The element's text:style-name attribute references a ruby style that specifies further formatting attributes of the ruby. See section 14.8.4 for details.

The <text:ruby-text > element contains the annotation text. It may contain only plain text. The element's text:style-name attribute references a text style that specifies further formatting attributes used for the text.

<define name="paragraph-content" combine="choice">

<element name="text:ruby">

<optional>

<attribute name="text:style-name">

<ref name="styleNameRef"/>

</attribute>

</optional>

<element name="text:ruby-base">

<ref name="paragraph-content"/>

</element>

<element name="text:ruby-text">

<optional>

<attribute name="text:style-name">

<ref name="styleNameRef"/>

</attribute>

</optional>

<text/>

</element>

</element>

</define>

5.5Text Annotation

The OpenDocument format allows annotation to appear within a paragraph element. See section 12.1 for details on annotations.

<define name="paragraph-content" combine="choice">

<ref name="office-annotation"/>

</define>

5.6Index Marks

Index marks are used to mark text areas for inclusion into text indices. They are similar in structure to bookmarks and references. They are discussed in detail section 7.1, together with text indices.

5.7Change Tracking and Change Marks

Paragraphs may also contain change tracking marks. These have already been explained in the chapter on change tracking (section 4.6), and are referenced here for completeness.

<define name="paragraph-content" combine="choice">

<ref name="change-marks"/>

</define>

5.8Inline graphics and text-boxes

Within text documents, images, embedded objects and other drawing objects may be anchored to a paragraph, to a character, or as a character. If they are anchored to a paragraph, they appear within a paragraph at an arbitrary position. If they are anchored to or as a character, they appear within a paragraph at exactly the character position they are anchored to or as. See section 9.2 for details on drawing objects, and section 9.2.16 for their anchoring.

<define name="paragraph-content" combine="choice">

<choice>

<ref name="shape"/>

<ref name="draw-a"/>

</choice>

</define>

6Text Fields

OpenDocument text documents or OpenDocument text content embedded in other types of documents can contain variable text elements called fields. There are several different types of field, each of which implements a different type of variable text element. Fields are most commonly used for:

This section describes how fields are represented in the OpenDocument file format.

6.1Common Characteristics of Field Elements

Each field type is represented by a corresponding element type. A field in a document is encoded as a single element of the appropriate type. The content of the element is the textual representation of the current field value as it would be displayed or printed. Therefore, ignoring all field elements and displaying only the textual content of the elements provides an approximate text-only version of the document.

The value of a field is usually stored in an attribute. It is necessary to store the value so that the presentation of the field can be recomputed if necessary, for example, if the user decides to change the formatting style of the field. It is also necessary to store the presentation style of the element content, to facilitate easy processing of the XML document. For example, if complete processing of a field is impossible or undesirable, the application can ignore the field and use only the content in this situation. For string values, if the value is identical to the presentation, the value attribute is omitted to avoid duplicate storage of information.

For fields that can store different types of content, for example, numbers, strings, or dates, a value type is stored in addition to the actual value. The value and value type attributes are explained later in section 6.7.1. If more information is needed to restore a field, it is stored in additional attributes.

The most common attributes of field elements are:

6.2Document Fields

OpenDocument fields can display information about the current document or about a specific part of the current document, such as the author, the current page number, or the document creation date. These fields are collectively referred to as document fields.

Document fields are often fixed. A field can be marked fixed to indicate that its content is preserved, rather than re-evaluated, when the document is edited. For example, a date field shows the current date. If the date field is marked fixed, the value of the field is preserved during subsequent edits and always reflects the original date on which the field was inserted into the document. If the field is not marked fixed, its value changes whenever the document is edited. In the same way, the author field can show the original author or the last author of a document, depending on whether the field is marked fixed or not.

The group of document fields includes:

6.2.1Date Fields

Date fields display the current date. The date can be adjusted to display a date other than the current date. For example, the date can be changed on a document that was edited late at night so that it displays the date of the following day or several days later.

This element contains the presentation of the date field value, depending on the data style specified. The default date is the current date. The value of this element can be preserved using the text:fixed attribute described in section 6.7.2.

<define name="paragraph-content" combine="choice">

<element name="text:date">

<ref name="text-date-attlist"/>

<text/>

</element>

</define>

The attributes that may be associated with the <text:date> element are:

<define name="text-date-attlist" combine="interleave">

<interleave>

<ref name="common-field-fixed-attlist"/>

<ref name="common-field-data-style-name-attlist"/>

</interleave>

</define>

Date Value

The text:date-value attribute specifies a particular date value. For example, if the date field is marked fixed, this attribute can be used to specify the date on which the field was marked as fixed. This attribute can also be used to specify a future date. Some applications support date and time in addition to date-only values.

The date value should conform with the date formats described in §3.2.7 and §3.2.9 of [xmlschema-2]. If no value is specified, the current date is assumed, even if the field is marked fixed.

<define name="text-date-attlist" combine="interleave">

<optional>

<attribute name="text:date-value">

<ref name="dateOrDateTime"/>

</attribute>

</optional>

</define>

Date Adjustment

The value of a date field can be adjusted by a certain time period, which is specified using the text:date-adjust attribute. If the time period is negative, it gets subtracted from the value of the date field, yielding a date before the current date.

The value of this attribute must conform to the time period format described in §3.2.6 of [xmlschema-2]. The value can be preceded by an optional minus sign to indicate a negative time duration.

<define name="text-date-attlist" combine="interleave">

<optional>

<attribute name="text:date-adjust">

<ref name="duration"/>

</attribute>

</optional>

</define>

6.2.2Time Fields

Time fields display the current time. They are very similar to the date fields described in section 6.2.1, supporting the same attributes except that for time fields, they are called text:time-value and text:time-adjust attributes.

This element contains the presentation of the time field value, depending on the data style specified. The default time is the current time. The value of this element can be preserved using the text:fixed attribute described in section 6.7.2.

<define name="paragraph-content" combine="choice">

<element name="text:time">

<ref name="text-time-attlist"/>

<text/>

</element>

</define>

The attributes that may be associated with the <text:time> element are:

<define name="text-time-attlist" combine="interleave">

<interleave>

<ref name="common-field-fixed-attlist"/>

<ref name="common-field-data-style-name-attlist"/>

</interleave>

</define>

Time Value

The text:time-value attribute records the time at which the document was last edited.

Some applications support date and time in addition to date-only values.

The value of this attribute must conform with either the “dateTime” or “time” data types described in §3.2.7 and §3.2.8 of [xmlschema-2]. If no value is specified, the current time is assumed, even if the field is marked fixed.

<define name="text-time-attlist" combine="interleave">

<optional>

<attribute name="text:time-value">

<ref name="timeOrDateTime"/>

</attribute>

</optional>

</define>

Time Adjustment

The value of a time field can be adjusted by a certain time period, which is specified using the text:time-adjust attribute.

The value of this attribute must conform to the time period format described in §3.2.6 of [xmlschema-2]. The value can be preceded by an optional minus sign to indicate a negative time duration. Positive values adjust the time to a time in the future, while negative values adjust the time to a time in the past. The duration is truncated to full minutes.

<define name="text-time-attlist" combine="interleave">

<optional>

<attribute name="text:time-adjust">

<ref name="duration"/>

</attribute>

</optional>

</define>

Example: Time adjust attributes and their effects

If the attribute text:time-adjust="PTM15", the time field displays a time which is 15 minutes later than the actual time specified by the time field value.

If the attribute text:time-adjust="-PTH1", the time field displays a time which is one hour before the actual time specified by the time field value.

6.2.3Page Number Fields

Page number fields display the current page number. These fields are particularly useful in headers and footers. E.g., if a page number field is inserted into a footer, the current page number is displayed on every page on which the footer appears.

The attributes that may be associated with the <text:page-number> element are:

<define name="paragraph-content" combine="choice">

<element name="text:page-number">

<ref name="text-page-number-attlist"/>

<text/>

</element>

</define>

<define name="text-page-number-attlist" combine="interleave">

<interleave>

<ref name="common-field-num-format-attlist"/>

<ref name="common-field-fixed-attlist"/>

</interleave>

</define>

Note: To display the total number of pages in a document, use the <text:page-count/> field described in section 6.4.17.

Page Adjustment

The value of a page number field can be adjusted by a specified number, allowing the display of page numbers of following or preceding pages. The adjustment amount is specified using the text:page-adjust attribute. When this attribute is used, the application:

  1. Adds the value of the attribute to the current page number.

  2. Checks to see if the resulting page exists.

  3. If the page exists, the number of that page is displayed.

  4. If the page does not exist, the value of the page number field remains empty and no number is displayed.

<define name="text-page-number-attlist" combine="interleave">

<optional>

<attribute name="text:page-adjust">

<ref name="integer"/>

</attribute>

</optional>

</define>

Display Previous or Following Page Numbers

The text:select-page attribute is used to display the number of the previous or the following page rather than the number of the current page.

<define name="text-page-number-attlist" combine="interleave">

<optional>

<attribute name="text:select-page">

<choice>

<value>previous</value>

<value>current</value>

<value>next</value>

</choice>

</attribute>

</optional>

</define>

Note: To display the current page number on all pages except the first or last page, use a combination of the text:select page and text:page adjust attributes.

Example: Displaying the current page number on all pages except the first page

<text:page-number text:select-page="previous"
text:page-adjust="1"
style:num-format="1"/>

6.2.4Page Continuation Text

In some publications, a continuation reminder is printed at the bottom of the page in addition to the page number. To include a continuation reminder, use the <text:page-continuation> element.

<define name="paragraph-content" combine="choice">

<element name="text:page-continuation">

<ref name="text-page-continuation-attlist"/>

<text/>

</element>

</define>

The attributes associated with the <text:page-continuation> element are:

Previous or Following Page

This attribute specifies whether to check for a previous or next page and if the page exists, the continuation text is printed.

<define name="text-page-continuation-attlist" combine="interleave">

<attribute name="text:select-page">

<choice>

<value>previous</value>

<value>next</value>

</choice>

</attribute>

</define>

String Value

This attribute specifies the continuation text to display. If this attribute is omitted, the element content is used.

<define name="text-page-continuation-attlist" combine="interleave">

<optional>

<attribute name="text:string-value">

<ref name="string"/>

</attribute>

</optional>

</define>

6.2.5Sender Fields

There are several fields which contain information about the sender of the current document, for example, name and email address. The information about the sender is taken from the OpenDocument user information dialog. If a sender field is marked fixed using the text:fixed attribute, the original sender information in the sender fields is preserved. (cf. section 6.7.2) Otherwise, the information is updated each time the file is edited, causing the fields to change value when the document is edited by a different user.

First Name

This element represents the first name of the sender.

<define name="paragraph-content" combine="choice">

<element name="text:sender-firstname">

<ref name="common-field-fixed-attlist"/>

<text/>

</element>

</define>

Last Name

This element represents the last name of the sender.

<define name="paragraph-content" combine="choice">

<element name="text:sender-lastname">

<ref name="common-field-fixed-attlist"/>

<text/>

</element>

</define>

Initials

This element represents the initials of the sender.

<define name="paragraph-content" combine="choice">

<element name="text:sender-initials">

<ref name="common-field-fixed-attlist"/>

<text/>

</element>

</define>

Title

This element represents the title of the sender.

<define name="paragraph-content" combine="choice">

<element name="text:sender-title">

<ref name="common-field-fixed-attlist"/>

<text/>

</element>

</define>

Position

This element represents the position of the sender.

<define name="paragraph-content" combine="choice">

<element name="text:sender-position">

<ref name="common-field-fixed-attlist"/>

<text/>

</element>

</define>

Email Address

This element represents the email address of the sender.

<define name="paragraph-content" combine="choice">

<element name="text:sender-email">

<ref name="common-field-fixed-attlist"/>

<text/>

</element>

</define>

Private Telephone Number

This element represents the private telephone number of the sender.

<define name="paragraph-content" combine="choice">

<element name="text:sender-phone-private">

<ref name="common-field-fixed-attlist"/>

<text/>

</element>

</define>

Fax Number

This element represents the facsimile number of the sender.

<define name="paragraph-content" combine="choice">

<element name="text:sender-fax">

<ref name="common-field-fixed-attlist"/>

<text/>

</element>

</define>

Company Name

This element represents the name of the company that employs the sender.

<define name="paragraph-content" combine="choice">

<element name="text:sender-company">

<ref name="common-field-fixed-attlist"/>

<text/>

</element>

</define>

Office Telephone Number

This element represents the office telephone number of the sender.

<define name="paragraph-content" combine="choice">

<element name="text:sender-phone-work">

<ref name="common-field-fixed-attlist"/>

<text/>

</element>

</define>

Street

This element represents the street name of the address of the sender.

<define name="paragraph-content" combine="choice">

<element name="text:sender-street">

<ref name="common-field-fixed-attlist"/>

<text/>

</element>

</define>

City

This element represents the city name of the address of the sender.

<define name="paragraph-content" combine="choice">

<element name="text:sender-city">

<ref name="common-field-fixed-attlist"/>

<text/>

</element>

</define>

Postal Code

This element represents the postal code of the address of the sender.

<define name="paragraph-content" combine="choice">

<element name="text:sender-postal-code">

<ref name="common-field-fixed-attlist"/>

<text/>

</element>

</define>

Country

This element represents the country of the address of the sender.

<define name="paragraph-content" combine="choice">

<element name="text:sender-country">

<ref name="common-field-fixed-attlist"/>

<text/>

</element>

</define>

State or Province

This element represents the state or province of the address of the sender, if applicable.

<define name="paragraph-content" combine="choice">

<element name="text:sender-state-or-province">

<ref name="common-field-fixed-attlist"/>

<text/>

</element>

</define>

6.2.6Author Fields

There are two elements available to display the author of a document. One element displays the full name of the author and the other element displays the initials of the author.

The value of author fields can be fixed using the text:fixed attribute. Marking an author field as fixed preserves the original field content. Otherwise, the field content changes each time the document is updated, to reflect the last author of the document.

Name of the Author

This element represents the full name of the author.

<define name="paragraph-content" combine="choice">

<element name="text:author-name">

<ref name="common-field-fixed-attlist"/>

<text/>

</element>

</define>

Initials of the Author

This element represents the initials of the author.

<define name="paragraph-content" combine="choice">

<element name="text:author-initials">

<ref name="common-field-fixed-attlist"/>

<text/>

</element>

</define>

6.2.7Chapter Fields

Chapter fields display one of the following:

If the chapter field is placed inside a header or footer, it displays the current chapter name or number on every page.

<define name="paragraph-content" combine="choice">

<element name="text:chapter">

<ref name="text-chapter-attlist"/>

<text/>

</element>

</define>

The attributes that may be associated with the <text:chapter> element are:

Display

The text:display attribute specifies the information that the chapter field should display.

<define name="text-chapter-attlist" combine="interleave">

<attribute name="text:display">

<choice>

<value>name</value>

<value>number</value>

<value>number-and-name</value>

<value>plain-number-and-name</value>

<value>plain-number</value>

</choice>

</attribute>

</define>

Example: If the current chapter number is 2.4, the chapter title is Working with Tables, the prefix is [, and suffix is ], the possible display options and results are as follows:

Value of text:display attribute

Field content displayed

number

[2.4]

name

Working with Tables

number-and-name

[2.4] Working with Tables

plain-number

2.4 

plain-number-and-name

2.4 Working with Tables

Outline Level

This attribute is used to specify the outline level to use. The chapter field displays the chapter number or title up to the specified outline level.

<define name="text-chapter-attlist" combine="interleave">

<attribute name="text:outline-level">

<ref name="nonNegativeInteger"/>

</attribute>

</define>

6.2.8File Name Fields

File name fields display the name of the file that is currently being edited.

The attributes that may be associated with the <text:file-name> element are:

<define name="paragraph-content" combine="choice">

<element name="text:file-name">

<ref name="text-file-name-attlist"/>

<text/>

</element>

</define>

Display

The text:display attribute specifies how much of the file name to display. The following display options are allowed:

The filename might be an IRI, either because an IRI has been used to retrieve the file, or the application internally uses IRIs and therefore converts even system specific paths into an IRI. If this is the case, and if the path, the name or the extension cannot be evaluated from the IRI, then the IRI should be displayed unmodified.

<define name="text-file-name-attlist" combine="interleave">

<optional>

<attribute name="text:display">

<choice>

<value>full</value>

<value>path</value>

<value>name</value>

<value>name-and-extension</value>

</choice>

</attribute>

</optional>

</define>

Fixed File Name Fields

If a file name field is fixed, its value does not change when the file is edited.

<define name="text-file-name-attlist" combine="interleave">

<ref name="common-field-fixed-attlist"/>

</define>

6.2.9Document Template Name Fields

The document template name field displays information about the document template in use, such as the template title or the file name.

The only attribute that may be associated with the <text:template-name> element is:

<define name="paragraph-content" combine="choice">

<element name="text:template-name">

<ref name="text-template-name-attlist"/>

<text/>

</element>

</define>

Display

This attribute specifies which information about the document template to display. The following display options are allowed:

The latter two values can be used for template dialogs. The values are a superset of the display values available for the <text:file-name> element.

<define name="text-template-name-attlist">

<optional>

<attribute name="text:display">

<choice>

<value>full</value>

<value>path</value>

<value>name</value>

<value>name-and-extension</value>

<value>area</value>

<value>title</value>

</choice>

</attribute>

</optional>

</define>

6.2.10Sheet Name Fields

For Spreadsheet documents, sheet name fields display the name of the sheet that is currently being edited.

<define name="paragraph-content" combine="choice">

<element name="text:sheet-name">

<text/>

</element>

</define>

6.3Variable Fields

OpenDocument text documents can contain variables, which are processed or displayed using variable fields. A variable is a name/value pair. The variable name is used throughout the document to identify a particular variable, and therefore variable names cannot be reused for different types of variables. Most variable fields support different value types, such as numbers, dates, strings, and so on. In the OpenDocument file format, a variable must be declared at the beginning of a document.

There are three types of variables:

Expression and text input fields are also variable fields, but they are not associated with any particular variables. Since their functionality is closely related to that of the variable fields, they are also described in this section of the manual.

Variables must be declared before they can be used. The variable declarations are collected in container elements for the particular variable type. The OpenDocument code for declaring variables is described in sections 6.3.1, 6.3.5 and 6.3.8.

6.3.1Declaring Simple Variables

Simple variables are declared using <text:variable-decl> elements. The declaration specifies the name and the value type of the variable.

To specify the name and value type of the simple variable, the following attributes are attached to the <text:variable-decl> element:

<define name="text-variable-decl">

<element name="text:variable-decl">

<ref name="common-field-name-attlist"/>

<ref name="common-value-type-attlist"/>

</element>

</define>

6.3.2Setting Simple Variables

Simple variables can be set using variable setter elements. This element contains the presentation of the value of the variable, which can be empty if the text:display attribute is set to none.

The attributes that may be associated with the <text:variable-set> element are:

<define name="paragraph-content" combine="choice">

<element name="text:variable-set">

<interleave>

<ref name="common-field-name-attlist"/>

<ref name="common-field-formula-attlist"/>

<ref name="common-value-and-type-attlist"/>

<ref name="common-field-display-value-none-attlist"/>

<ref name="common-field-data-style-name-attlist"/>

</interleave>

<text/>

</element>

</define>

6.3.3Displaying Simple Variables

The <text:variable-get> element reads and displays the value of a simple variable. The value of this element is the value of the last preceding <text:variable-set> element with an identical text:name attribute. The element determines how the value of the variable is presented, in accordance with the chosen formatting style.

The attributes that may be associated with the <text:variable-get> element are:

<define name="paragraph-content" combine="choice">

<element name="text:variable-get">

<interleave>

<ref name="common-field-name-attlist"/>

<ref name="common-field-display-value-formula-attlist"/>

<ref name="common-field-data-style-name-attlist"/>

</interleave>

<text/>

</element>

</define>

6.3.4Simple Variable Input Fields

As an alternative to setting simple variables using formulas in variable setter elements, the user can be prompted for variable values. To do this, use the <text:variable-input> element. This element contains the presentation of the variable's value according to the chosen formatting style. The presentation can be empty if the text:display attribute is set to none.

The attributes that may be associated with the <text:variable-input> element are:

<define name="paragraph-content" combine="choice">

<element name="text:variable-input">

<interleave>

<ref name="common-field-name-attlist"/>

<ref name="common-field-description-attlist"/>

<ref name="common-value-type-attlist"/>

<ref name="common-field-display-value-none-attlist"/>

<ref name="common-field-data-style-name-attlist"/>

</interleave>

<text/>

</element>

</define>

6.3.5Declaring User Variables

User variables contain values that are displayed using appropriate fields. Unlike simple variables, user variables have the same value throughout a document. For this reason, the value of user variables is stored in the variable declaration itself.

The attributes that may be associated with the <text:user-field-del> element are:

<define name="text-user-field-decl">

<element name="text:user-field-decl">

<ref name="common-field-name-attlist"/>

<optional>

<ref name="common-field-formula-attlist"/>

</optional>

<ref name="common-value-and-type-attlist"/>

</element>

</define>

6.3.6Displaying User Variables

The content of user variables can be displayed using <text:user-field-get> elements.

The attributes that may be associated with the <text:user-field-get> element are:

<define name="paragraph-content" combine="choice">

<element name="text:user-field-get">

<interleave>

<ref name="common-field-name-attlist"/>

<ref name="common-field-display-value-formula-none-attlist"/>

<ref name="common-field-data-style-name-attlist"/>

</interleave>

<text/>

</element>

</define>

6.3.7User Variable Input Fields

An alternative method of setting user variables is to use input fields, similar to the input fields for simple variables. A user variable can be set in this way using the <text:user-field-input> element. Since the value of a user field variable is stored in the <text:user-field-del> element, the <text:user-field-input> element does not contain the value and value type attributes from the <text:variable-input> field.

The presentation can be empty if the text:display attribute is set to none.

The attributes that may be associated with the <text:user-field-input> element are:

<define name="paragraph-content" combine="choice">

<element name="text:user-field-input">

<interleave>

<ref name="common-field-name-attlist"/>

<ref name="common-field-description-attlist"/>

<ref name="common-field-data-style-name-attlist"/>

</interleave>

<text/>

</element>

</define>

6.3.8Declaring Sequence Variables

Sequence variables are used to number items within an OpenDocument text document. Sequence variables are most commonly used for sequential numbering. However, expression formulas can be included in sequence fields to support more advanced sequences. See section 6.3.9 for more information on Using Sequence Fields and their uses.

Sequence variables are declared using the <text:sequence-del> element.

To facilitate chapter-specific numbering, attributes can be attached to a sequence variable to specify a chapter level and a separation character. The attributes that may be associated with the <text:sequence-del> element are:

<define name="text-sequence-decl">

<element name="text:sequence-decl">

<ref name="text-sequence-decl-attlist"/>

</element>

</define>

<define name="text-sequence-decl-attlist" combine="interleave">

<ref name="common-field-name-attlist"/>

</define>

Outline Level

Sequences can be numbered by chapter. To use this feature, use the text:display-outline-level attribute to specify an outline level that determines which chapters to reference for the chapter-specific numbering. All chapters that are at or below the specified outline level reset the value of the sequence to zero, the default value. Also, the chapter number of the last chapter at or below the specified outline level is prefixed to the sequence number. Choosing an outline level of zero results in a straight sequence of all sequence elements for that sequence variable.

<define name="text-sequence-decl-attlist" combine="interleave">

<attribute name="text:display-outline-level">

<ref name="nonNegativeInteger"/>

</attribute>

</define>

Separation Character

If sequences are numbered by chapter, this attribute is used to choose a character to separate the chapter number from the sequence number.

If the value of the text:display-outline-level attribute is a non-zero value, a separation character may be specified. The default separation character is ".".Otherwise, if the value of text:display-outline-level is zero, this attribute must be omitted.

<define name="text-sequence-decl-attlist" combine="interleave">

<optional>

<attribute name="text:separation-character">

<ref name="character"/>

</attribute>

</optional>

</define>

Example: Sequence variable

The sequence variable 3.7.36#5 with a value of 5 is declared using:

Attribute

Value

text:display-outline-level

3

text:separation-character

#

6.3.9Using Sequence Fields

Once a sequence variable is declared, it can be used in sequence fields throughout the document. Most sequence fields simply increment and display the sequence variable. However, sequence fields can also assume a new start value at any given position in a document. This start value is computed using a formula which is contained in the sequence field. If a sequence field without a start value is added, the office application software automatically inserts an expression of the type variable+1.

Sequence fields are most commonly used for simple counting sequences. However, the ability to provide arbitrary expressions supports more complex sequences. To form a sequence of even numbers, all sequence elements for that particular variable need to contain a formula incrementing the value by two, for example, variable+2. A sequence with a starting value of 1 and all subsequent elements using the formula variable*2 yields all powers of two. Since different sequence elements for the same sequence variable may contain different formulas, complex sequences may be constructed.

The attributes that may be associated with the <text:sequence> element are:

<define name="paragraph-content" combine="choice">

<element name="text:sequence">

<interleave>

<ref name="common-field-name-attlist"/>

<ref name="common-field-formula-attlist"/>

<ref name="common-field-num-format-attlist"/>

<ref name="text-sequence-ref-name"/>

</interleave>

<text/>

</element>

</define>

Reference Name

Sequence fields can be the target of references, as implemented using reference fields. See section 6.6.5 for more information about reference fields. To enable a reference field to identify a particular sequence field, the sequence field must contain an additional attribute containing a name. No two sequence fields can have the same reference name.

If the sequence field is not the target of a reference, this attribute can be omitted.

<define name="text-sequence-ref-name">

<optional>

<attribute name="text:ref-name">

<ref name="string"/>

</attribute>

</optional>

</define>

6.3.10Expression Fields

Expression fields contain expressions that are evaluated and the resulting value is displayed. The value of the expression is formatted according to the chosen formatting style.

The attributes that may be associated with the <text:expression> element are:

<define name="paragraph-content" combine="choice">

<element name="text:expression">

<interleave>

<ref name="common-field-formula-attlist"/>

<optional>

<ref name="common-value-and-type-attlist"/>

</optional>

<ref name="common-field-display-value-formula-attlist"/>

<ref name="common-field-data-style-name-attlist"/>

</interleave>

<text/>

</element>

</define>

6.3.11Text Input Fields

A text input field is a variable field. From the point of view of the user interface, a text input field is similar to the <text:variable-input> and <text:user-field-input> fields. However, the text input field does not change the value of any variables.

The only attribute that may be associated with the <text:text-input> element is:

<define name="paragraph-content" combine="choice">

<element name="text:text-input">

<ref name="common-field-description-attlist"/>

<text/>

</element>

</define>

6.4Metadata Fields

Metadata fields display meta information about the document, such as, the document creation date or the time at which the document was last printed. The names of the metadata field elements correspond to the metadata elements described in Chapter 3.

All metadata field elements can be marked as fixed using the text:fixed attribute. (Cf. section 6.7.2)

Several metadata fields display a date or a time. The elements for these fields require an associated text:date-value or a text:time-value attribute, and optionally, they can also have a style:data-style-name attribute. See section 6.7.1 for more information on these attributes.

6.4.1Initial Creator

This element represents the name of the author who created the original document.

<define name="paragraph-content" combine="choice">

<element name="text:initial-creator">

<ref name="common-field-fixed-attlist"/>

<text/>

</element>

</define>

6.4.2Document Creation Date

This element represents the date on which the document was created.

<define name="paragraph-content" combine="choice">

<element name="text:creation-date">

<interleave>

<ref name="common-field-fixed-attlist"/>

<ref name="common-field-data-style-name-attlist"/>

<optional>

<attribute name="text:date-value">

<ref name="dateOrDateTime"/>

</attribute>

</optional>

</interleave>

<text/>

</element>

</define>

6.4.3Document Creation Time

This element represents the time at which the document was created.

<define name="paragraph-content" combine="choice">

<element name="text:creation-time">

<interleave>

<ref name="common-field-fixed-attlist"/>

<ref name="common-field-data-style-name-attlist"/>

<optional>

<attribute name="text:time-value">

<ref name="timeOrDateTime"/>

</attribute>

</optional>

</interleave>

<text/>

</element>

</define>

6.4.4Document Description

This element contains a brief description of the document.

<define name="paragraph-content" combine="choice">

<element name="text:description">

<ref name="common-field-fixed-attlist"/>

<text/>

</element>

</define>

6.4.5User-Defined Document Information

This element contains user-defined information about the document. It displays the information provided within a <meta:user-defined> element that has the same name.

<define name="paragraph-content" combine="choice">

<element name="text:user-defined">

<interleave>

<ref name="common-field-fixed-attlist"/>

<attribute name="text:name">

<ref name="string"/>

</attribute>

<ref name="common-field-data-style-name-attlist"/>

<optional>

<attribute name="office:value">

<ref name="double"/>

</attribute>

</optional>

<optional>

<attribute name="office:date-value">

<ref name="dateOrDateTime"/>

</attribute>

</optional>

<optional>

<attribute name="office:time-value">

<ref name="duration"/>

</attribute>

</optional>

<optional>

<attribute name="office:boolean-value">

<ref name="boolean"/>

</attribute>

</optional>

<optional>

<attribute name="office:string-value">

<ref name="string"/>

</attribute>

</optional>

</interleave>

<text/>

</element>

</define>

6.4.6Print Time

This element represents the time at which the document was last printed.

<define name="paragraph-content" combine="choice">

<element name="text:print-time">

<interleave>

<ref name="common-field-fixed-attlist"/>

<ref name="common-field-data-style-name-attlist"/>

<optional>

<attribute name="text:time-value">

<ref name="time"/>

</attribute>

</optional>

</interleave>

<text/>

</element>

</define>

6.4.7Print Date

This element represents the date on which the document was last printed.

<define name="paragraph-content" combine="choice">

<element name="text:print-date">

<interleave>

<ref name="common-field-fixed-attlist"/>

<ref name="common-field-data-style-name-attlist"/>

<optional>

<attribute name="text:date-value">

<ref name="date"/>

</attribute>

</optional>

</interleave>

<text/>

</element>

</define>

6.4.8Printed By

This element represents name of the last person who printed the document.

<define name="paragraph-content" combine="choice">

<element name="text:printed-by">

<ref name="common-field-fixed-attlist"/>

<text/>

</element>

</define>

6.4.9Document Title

This element represents the title of the document.

<define name="paragraph-content" combine="choice">

<element name="text:title">

<ref name="common-field-fixed-attlist"/>

<text/>

</element>

</define>

6.4.10Document Subject

This element represents the subject of the document.

<define name="paragraph-content" combine="choice">

<element name="text:subject">

<ref name="common-field-fixed-attlist"/>

<text/>

</element>

</define>

6.4.11Document Keywords

This element contains a list of keywords used to describe the document.

<define name="paragraph-content" combine="choice">

<element name="text:keywords">

<ref name="common-field-fixed-attlist"/>

<text/>

</element>

</define>

6.4.12Document Revision Number

This element contains the document revision number. When the document is created, the revision number is set to 1. Each time the document is saved, the document revision number is incremented.

<define name="paragraph-content" combine="choice">

<element name="text:editing-cycles">

<ref name="common-field-fixed-attlist"/>

<text/>

</element>

</define>

Note: Since the <text:editing-cycles> field can not be formatted, the revision number can be read from the element content. Therefore, no extra attribute is needed.

6.4.13Document Edit Duration

Every time a document is edited, the office application records the duration between the time the document is opened and the time the document is closed. It then adds the duration to an internal counter, thereby keeping track of the total time that has been spent editing the document.

<define name="paragraph-content" combine="choice">

<element name="text:editing-duration">

<interleave>

<ref name="common-field-fixed-attlist"/>

<ref name="common-field-data-style-name-attlist"/>

<optional>

<attribute name="text:duration">

<ref name="duration"/>

</attribute>

</optional>

</interleave>

<text/>

</element>

</define>

6.4.14Document Modification Time

This element represents the time at which the document was last modified.

This element displays the information from the <meta:date> element. The name was chosen to avoid confusion with <text:date> fields.

<define name="paragraph-content" combine="choice">

<element name="text:modification-time">

<interleave>

<ref name="common-field-fixed-attlist"/>

<ref name="common-field-data-style-name-attlist"/>

<optional>

<attribute name="text:time-value">

<ref name="time"/>

</attribute>

</optional>

</interleave>

<text/>

</element>

</define>

6.4.15Document Modification Date

This element represents the date on which the document was last modified.

This element displays the information from the <meta:date> element. The name was chosen to avoid confusion with <text:date> fields.

<define name="paragraph-content" combine="choice">

<element name="text:modification-date">

<interleave>

<ref name="common-field-fixed-attlist"/>

<ref name="common-field-data-style-name-attlist"/>

<optional>

<attribute name="text:date-value">

<ref name="date"/>

</attribute>

</optional>

</interleave>

<text/>

</element>

</define>

6.4.16Document Modified By

This element represents the name of the person who last modified the document.

<define name="paragraph-content" combine="choice">

<element name="text:creator">

<ref name="common-field-fixed-attlist"/>

<text/>

</element>

</define>

6.4.17Document Statistics Fields

These fields display how many objects of a certain type a document contains. They can be used to display the number of

<define name="paragraph-content" combine="choice">

<element>

<choice>

<name>text:page-count</name>

<name>text:paragraph-count</name>

<name>text:word-count</name>

<name>text:character-count</name>

<name>text:table-count</name>

<name>text:image-count</name>

<name>text:object-count</name>

</choice>

<ref name="common-field-num-format-attlist"/>

<text/>

</element>

</define>

6.5Database Fields

Documents can reference databases and display database information as text content. To display database information, the OpenDocument schema uses a group of text fields, collectively called database fields. Office applications may use database tables from SQL servers, therefore database fields can be used to access any SQL database, provided that the appropriate drivers are available.

A database may contain the following components:

Database forms and reports are not relevant to text content, therefore they are not discussed in this chapter. From the point of view of embedding database information in OpenDocument text documents, queries and tables are considered the same. Therefore for the remainder of this section, the phrase database table refers to both database tables and database queries.

Database fields alone do not retrieve information from a database. In addition to the database fields, a set of database rows is also added to the document. When new data is added to the document, all database fields belonging to the added database table are updated. Using the office application user interface, database rows can be added in one of the following ways:

To display data from a database table use the <text:database-display> element. The <text:database-select> and <text:database-next> elements can be used to determine which row within the current selection should be displayed. The current row number for a particular table can be displayed using the <text:database-row-number> element. Finally, the <text:database-name> field displays the name of the most recently used database, which is the address book file database by default.

6.5.1Database Field Data Source

A database field's source can either be the name of a database, or an IRI containing database connection resource data. If the source is a database name, then this name is used by all of the office application components to identify a database. All database fields contain a database name or connection resource, and most database fields also contain the name of a database table, which must be stored in the database. An additional attribute determines whether the database table refers to an SQL table, an OpenDocument query, or the result of a SQL command.

<define name="common-field-database-table">

<ref name="common-field-database-table-attlist"/>

<ref name="common-field-database-name"/>

</define>

Database Name

The text:database-name attribute specifies the source database by its name.

<define name="common-field-database-name" combine="choice">

<optional>

<attribute name="text:database-name">

<ref name="string"/>

</attribute>

</optional>

</define>

Connection Resource

The <form:connection-resource> element specifies the source database by an [XLink]. Its xlink:href attribute either references a file containing a database, or it contains information on how to make a connection to a database, for instance a [JDBC] URL. See also section 11.1.20.

<define name="common-field-database-name" combine="choice">

<ref name="form-connection-resource"/>

</define>

Database Table Name

The text:table-name attribute specifies a table within the source database.

<define name="common-field-database-table-attlist" combine="interleave">

<attribute name="text:table-name">

<ref name="string"/>

</attribute>

</define>

Database Type

The text:table-type attribute determines whether the database table refers to an SQL table, an OpenDocument query, or the result of a SQL command.

<define name="common-field-database-table-attlist" combine="interleave">

<optional>

<attribute name="text:table-type">

<choice>

<value>table</value>

<value>query</value>

<value>command</value>

</choice>

</attribute>

</optional>

</define>

6.5.2Displaying Database Content

The <text:database-display> element displays data from a database. When a new data set is added to a document, all fields that display data from that database table update their content.

The attributes that may be associated with the <text:database-display> element are:

<define name="paragraph-content" combine="choice">

<element name="text:database-display">

<ref name="text-database-display-attlist"/>

<text/>

</element>

</define>

<define name="text-database-display-attlist" combine="interleave">

<ref name="common-field-database-table"/>

</define>

<define name="text-database-display-attlist" combine="interleave">

<ref name="common-field-data-style-name-attlist"/>

</define>

Column Name

The text:column-name attribute specifies the column from which to display the data. The value of this attribute must be a column contained in the specified database.

<define name="text-database-display-attlist" combine="interleave">

<attribute name="text:column-name">

<ref name="string"/>

</attribute>

</define>

6.5.3Selecting the Next Database Row

The <text:database-next> element changes the row in the current selection which is used for display in all following <text:database-display> fields. The next row from the current selection is chosen if it satisfies a given condition. If the next row is wanted regardless of any condition, the condition may be omitted or set to true.

The attributes that may be associated with the <text:database-next> are:

<define name="paragraph-content" combine="choice">

<element name="text:database-next">

<ref name="text-database-next-attlist"/>

</element>

</define>

<define name="text-database-next-attlist" combine="interleave">

<ref name="common-field-database-table"/>

</define>

Condition

The text:condition attribute specifies the condition expression. The expression is evaluated and if the result interpreted as a Boolean value is true, the next row is used as the new current row. Database field values can be used in the expression by enclosing in square brackets the database name, the table name, and the column name, separated by dots.

If the text:condition attribute is not present, it is assumes that the formula true, meaning that the next row is selected unconditionally.

<define name="text-database-next-attlist" combine="interleave">

<optional>

<attribute name="text:condition">

<ref name="formula"/>

</attribute>

</optional>

</define>

Example:

text:formula='ooo-w:[address book file.address.FIRSTNAME] == "Julie"'

This example specifies a condition that is true if the current row from an address book database table is the address for a person named Julie. If the condition shown in this example is used in a <text:database-next> element, the following happens:

See section 6.7.6 for more information on the formula syntax of a text:condition attribute, which is the same as that of the text:formula attribute.

6.5.4Selecting a Row Number

The <text:database-row-select> element selects a specific row from the current selection. As with the <text:database-row-next> element, a condition can be specified so that the given row is only selected if the condition is true.

The attributes that may be associated with the <text:database-row-select> are:

<define name="paragraph-content" combine="choice">

<element name="text:database-row-select">

<ref name="text-database-row-select-attlist"/>

</element>

</define>

<define name="text-database-row-select-attlist" combine="interleave">

<ref name="common-field-database-table"/>

</define>

<define name="text-database-row-select-attlist" combine="interleave">

<optional>

<attribute name="text:condition">

<ref name="formula"/>

</attribute>

</optional>

</define>

Selecting the Row Number

This attribute specifies the row number to select when a condition is true.

<define name="text-database-row-select-attlist" combine="interleave">

<optional>

<attribute name="text:row-number">

<ref name="nonNegativeInteger"/>

</attribute>

</optional>

</define>

6.5.5Displaying the Row Number

The <text:database-row-number> element displays the current row number for a given table. Note that the element displays the actual row number from the database and not the row number of the current selection that is used as an attribute value in the <text:database-row-select> element.

The attributes that may be associated with the <text:database-row-number> are:

<define name="paragraph-content" combine="choice">

<element name="text:database-row-number">

<interleave>

<ref name="common-field-database-table"/>

<ref name="common-field-num-format-attlist"/>

<optional>

<attribute name="text:value">

<ref name="nonNegativeInteger"/>

</attribute>

</optional>

</interleave>

<text/>

</element>

</define>

6.5.6Display Current Database and Table

Office applications may keeps track of the last database and table that was used in the document. In other words, the table that is used by the last field that was inserted into the document. The <text:database-name> element displays the database and table name of the most recently used table.

The attributes that may be associated with the <text:database-name> element are:

<define name="paragraph-content" combine="choice">

<element name="text:database-name">

<ref name="common-field-database-table"/>

<text/>

</element>

</define>

6.6More Fields

6.6.1Page Variable Fields

Page variables allow an alternative page numbering scheme to be defined. There is only one page variable, and it is set by any set page variable field in the document. The value of the page variable is increased on each page, in the same way as regular page numbers.

Setting Page Variable Fields

To set a page variable field, use the <text:variable-page-set> element.

<define name="paragraph-content" combine="choice">

<element name="text:page-variable-set">

<ref name="text-set-page-variable-attlist"/>

<text/>

</element>

</define>

Turning Page Variables On or Off

At the beginning of a document, the page variable is inactive. The text:active attribute can be used to disable a page variable after it was used in the document.

<define name="text-set-page-variable-attlist" combine="interleave">

<optional>

<attribute name="text:active">

<ref name="boolean"/>

</attribute>

</optional>

</define>

Page Variable Adjustment

The text:page-adjust attribute determines the page adjustment. The value of the active page variable is the current page number plus the closest page adjustment value that was previously set.

<define name="text-set-page-variable-attlist" combine="interleave">

<optional>

<attribute name="text:page-adjust">

<ref name="integer"/>

</attribute>

</optional>

</define>

Displaying Page Variable Fields

The <text:variable-page-get> element displays the value of the page variable. The field can be formatted in the same way as regular page number fields.

<define name="paragraph-content" combine="choice">

<element name="text:page-variable-get">

<ref name="text-get-page-variable-attlist"/>

<text/>

</element>

</define>

The attributes that may be associated with the <text:get-page-variable> element are:

<define name="text-get-page-variable-attlist" combine="interleave">

<ref name="common-field-num-format-attlist"/>

</define>

6.6.2Placeholders

The OpenDocument format uses placeholder fields to indicate locations in a document where the user must fill in some information. For example in a letter template, a section of the document can be reserved for the address of the recipient. A placeholder field displays text informing the user about the purpose of the placeholder and sometimes includes a description. Placeholder fields can represent different text elements, such as text or tables.

This element contains some brief text which is displayed with the placeholder.

<define name="paragraph-content" combine="choice">

<element name="text:placeholder">

<ref name="text-placeholder-attlist"/>

<text/>

</element>

</define>

The attributes that may be associated with the <text:placeholder> element are:

Placeholder Type

There are five different types of placeholder, representing the five possible types of content: text, tables, text boxes, images, or objects. The text:placeholder-type attribute represents the content type. This attribute is mandatory and it indicates which type of text content the placeholder represents. The value of the attribute can be text, text-box, image, table, or object.

<define name="text-placeholder-attlist" combine="interleave">

<attribute name="text:placeholder-type">

<choice>

<value>text</value>

<value>table</value>

<value>text-box</value>

<value>image</value>

<value>object</value>

</choice>

</attribute>

</define>

Placeholder Description

In addition to the brief text stored in the element content, may be associated a text:description attribute with the placeholder element. This attribute is optional. The purpose of the attribute is to contain a more elaborate description of the purpose of the placeholder than the description stored in the element content. See section 6.7.4 for information on using the text:description attribute.

<define name="text-placeholder-attlist" combine="interleave">

<ref name="common-field-description-attlist"/>

</define>

6.6.3Conditional Text Fields

Text fields can be used to display one text or another, depending on a condition. Conditional text fields are given a condition and two text strings. If the condition is true, one of the text strings is displayed. If the condition is false, the other text string is displayed.

<define name="paragraph-content" combine="choice">

<element name="text:conditional-text">

<ref name="text-conditional-text-attlist"/>

<text/>

</element>

</define>

The attributes that may be associated with the <text:conditional-text> element are:

The text:condition attribute contains a Boolean expression. Depending on the result, the value of the text:display-if-true or text:display-if-false attribute is displayed.

<define name="text-conditional-text-attlist" combine="interleave">

<attribute name="text:condition">

<ref name="formula"/>

</attribute>

</define>

Text to Display if the Condition is True

The text:string-value-if-true attribute contains the text string to display if the condition is true.

<define name="text-conditional-text-attlist" combine="interleave">

<attribute name="text:string-value-if-true">

<ref name="string"/>

</attribute>

</define>

Text to Display if the Condition is False

The text:string-value-if-false attribute contains the text string to display if the condition is false.

<define name="text-conditional-text-attlist" combine="interleave">

<attribute name="text:string-value-if-false">

<ref name="string"/>

</attribute>

</define>

Current Value and Condition

The text:current-value attribute contains the evaluation result of the condition given by the expression in the text:condition attribute. Explicitly giving the result allows applications to delay evaluating the result until necessary. This attribute is valuable for the following reasons:

<define name="text-conditional-text-attlist" combine="interleave">

<optional>

<attribute name="text:current-value">

<ref name="boolean"/>

</attribute>

</optional>

</define>

Note: The value of this attribute is overwritten with a new value as soon as the application evaluates the expression. This attribute has no function other than to ease transformation or initially display the document.

6.6.4Hidden Text Field

The hidden text field is closely related to the conditional text field. It displays fixed text, except when the condition is true when it does not display anything.

<define name="paragraph-content" combine="choice">

<element name="text:hidden-text">

<ref name="text-hidden-text-attlist"/>

<text/>

</element>

</define>

The attributes that may be associated with the <text:hidden-text> element are:

Condition

The text:condition attribute contains a Boolean expression. If the expression evaluates to true, the text is hidden.

<define name="text-hidden-text-attlist" combine="interleave">

<attribute name="text:condition">

<ref name="formula"/>

</attribute>

</define>

Text

The text:string-value attribute specifies the text to display if the condition is false.

<define name="text-hidden-text-attlist" combine="interleave">

<attribute name="text:string-value">

<ref name="string"/>

</attribute>

</define>

Is Hidden

The text:is-hidden attribute specifies whether or not the field is currently visible. The purpose of this attribute is similar to that of the text:current-value attribute in the text:condition field. Recording the result allows transformations to correctly represent the document without having to parse the condition expression or evaluate the condition when loading the document.

<define name="text-hidden-text-attlist" combine="interleave">

<optional>

<attribute name="text:is-hidden">

<ref name="boolean"/>

</attribute>

</optional>

</define>

Note: The value of this attribute is overwritten with a new value as soon as the application evaluates the expression. This attribute has no function other than to ease transformation or initially display the document.

6.6.5Reference Fields

The OpenDocument format uses four types of reference field and each type is represented by its own element. The reference field types are based on the type of element they refer to; notes, bookmarks, references, and sequences. Every reference contains a reference format which determines what information about the referenced target is displayed. For example, references can display:

In addition, each reference field must identify its target which is usually done using a name attribute. Bookmarks and references are identified by the name of the respective bookmark or reference. Footnotes, endnotes, and sequences are are assigned names by the application used to create the OpenDocument file format automatically.

<define name="paragraph-content" combine="choice">

<element>

<choice>

<name>text:reference-ref</name>

<name>text:bookmark-ref</name>

</choice>

<interleave>

<ref name="text-common-ref-content"/>

<ref name="text-ref-content"/>

</interleave>

</element>

</define>

<define name="paragraph-content" combine="choice">

<element name="text:note-ref">

<interleave>

<ref name="text-common-ref-content"/>

<ref name="text-note-ref-content"/>

<ref name="text-ref-content"/>

</interleave>

</element>

</define>

<define name="paragraph-content" combine="choice">

<element name="text:sequence-ref">

<interleave>

<ref name="text-common-ref-content"/>

<ref name="text-sequence-ref-content"/>

</interleave>

</element>

</define>

<define name="text-common-ref-content" combine="interleave">

<text/>

</define>

The attributes that may be associated with the reference field elements are:

Reference Name

The text:ref-name attribute identifies the referenced element. Since bookmarks and references have a name, this name is used by the respective reference fields. Footnotes, endnotes, and sequences are are identified by a name that is usually generated automatically.

<define name="text-common-ref-content" combine="interleave">

<optional>

<attribute name="text:ref-name">

<ref name="string"/>

</attribute>

</optional>

</define>

Note Class

For <text:note-ref> elements, the text:note-class attribute determines whether the field references a foot- or an endnote.

<define name="text-note-ref-content" combine="interleave">

<ref name="text-note-class"/>

</define>

Reference Format

The text:reference-format attribute determines what information about the reference is displayed. If the reference format is not specified, the page format is used as the default.

All types of reference fields support the following values for this attribute formats:

References to sequence fields support the following three additional values:

<define name="text-ref-content" combine="interleave">

<optional>

<attribute name="text:reference-format">

<choice>

<value>page</value>

<value>chapter</value>

<value>direction</value>

<value>text</value>

</choice>

</attribute>

</optional>

</define>

<define name="text-sequence-ref-content" combine="interleave">

<optional>

<attribute name="text:reference-format">

<choice>

<value>page</value>

<value>chapter</value>

<value>direction</value>

<value>text</value>

<value>category-and-value</value>

<value>caption</value>

<value>value</value>

</choice>

</attribute>

</optional>

</define>

Example: Different reference formats and displays

The following table shows all possible reference formats and the resulting reference display that can be used to refer to the table itself. The left column lists the value of the text:reference-format attribute and the right column

Reference format

Reference display

page

123

chapter

3.7.27

text

Table 2: Examples of reference formats

direction

above

category-and-value

Table 1

caption

Examples of reference formats

value

1

6.6.6Script Fields

A script field stores scripts or sections of scripts. The field can be used to store and edit scripts that are attached to the document. The primary purpose of this field is to provide an equivalent to the <script> element in [HTML4], so that the content of a <script> element in HTML can be imported, edited, and exported using an office application software.

The source code for the script can be stored in one of the following ways:

The element should have either a xlink:href attribute or content, but not both.

<define name="paragraph-content" combine="choice">

<element name="text:script">

<interleave>

<choice>

<group>

<attribute name="xlink:href">

<ref name="anyURI"/>

</attribute>

<optional>

<attribute name="xlink:type" a:defaultValue="simple">

<value>simple</value>

</attribute>

</optional>

</group>

<text/>

</choice>

<optional>

<attribute name="script:language">

<ref name="string"/>

</attribute>

</optional>

</interleave>

</element>

</define>

Script URL

The xlink:href attribute specifies the location of the file that contains the script source code. The script field should have either an URL attribute or content, but not both.

Script Language

The script:language attribute specifies the language in which the script source code is written, for example, JavaScript.

6.6.7Macro Fields

The macro field contains the name of a macro that is executed when the field is activated. The field also contains a description that is displayed as the field content.

The only attribute that may be associated with the <text:execute-macro> element is:

<define name="paragraph-content" combine="choice">

<element name="text:execute-macro">

<optional>

<attribute name="text:name">

<ref name="string"/>

</attribute>

</optional>

<optional>

<ref name="office-event-listeners"/>

</optional>

<text/>

</element>

</define>

Macro Name

The text:name attribute specifies the macro to invoke when the field is activated.

6.6.8Hidden Paragraph Fields

The hidden paragraph field has a similar function to the hidden text field. However, the hidden paragraph field does not have any content. It hides the paragraph in which it is contained. This allows a paragraph of formatted text to be hidden or displayed depending on whether a condition is true or false.

Hidden paragraph fields are often used together with form letters. For example, if a condition depends on a database field, a hidden paragraph field can be used to selectively include paragraphs in the form letter depending on the database content. Multiple paragraph fields can be contained one paragraph. The paragraph is displayed if the condition associated with at least one hidden paragraph field is false. Alternatively, the conditions associated with several hidden paragraph fields can be combined into a single condition for a single field using logical operations on the conditions.

Note: Unlike most fields, this field does not display text, but it affects the entire paragraph in which it is contained.

The attributes that may be associated with the <text:hidden-paragraph> element are:

<define name="paragraph-content" combine="choice">

<element name="text:hidden-paragraph">

<ref name="text-hidden-paragraph-attlist"/>

<text/>

</element>

</define>

Condition

The text:condition attribute contains a Boolean expression. If the condition is true, the paragraph is hidden. If the condition is false, the paragraph is displayed.

<define name="text-hidden-paragraph-attlist" combine="interleave">

<attribute name="text:condition">

<ref name="formula"/>

</attribute>

</define>

Is Hidden

The text:is-hidden attribute records whether the paragraph is currently visible or not. It has the same purpose as the corresponding attribute of the hidden text field, namely to allow correct display of the paragraph without having to evaluate the condition first. The value of this attribute is overwritten with a new value as soon as the application evaluates the expression.

Note: This attribute has no function other than to ease transformation or initially display the document.

<define name="text-hidden-paragraph-attlist" combine="interleave">

<optional>

<attribute name="text:is-hidden">

<ref name="boolean"/>

</attribute>

</optional>

</define>

6.6.9DDE Connection Fields

A DDE field allows information from a DDE connection to be displayed. The only parameter required for the DDE field is the name of the DDE connection that supplies the data to this field. This DDE connection element specifies the actual DDE field that appears in the text body.

The field element contains the content of the most recent data that was received from the DDE connection. This may be used to render the document if the DDE connection cannot be accessed.