GithubHelp home page GithubHelp logo

phpword's Introduction

PHPWord

This repository is an source code of PHPWord, turned into Composer package. This repository is forked from ferdynator.

Installation

All you have to do is to get composer and add following lines to your composer.json:

    "require": {
       "teqneers/phpword": "*"
    }

Examples

CantSplit in Tables

Prevents the splitting of a table row if the content does not fit on the page. The whole row moves to a new page. See http://msdn.microsoft.com/en-us/library/documentformat.openxml.wordprocessing.cantsplit(v=office.14).aspx

...
$wordTable = $section->addTable('tableStyle');
$wordTable->setCantSplit(true);
...

Usage of tab stops

<?php
require_once '../PHPWord.php';

// New Word Document
$PHPWord = new PHPWord();

$PHPWord->addParagraphStyle('multipleTab', array(
    'tabs' => array(
        new PHPWord_Style_Tab("left", 1550),
        new PHPWord_Style_Tab("center", 3200),
        new PHPWord_Style_Tab("right", 5300)
    )
));

$PHPWord->addParagraphStyle('rightTab', array(
    'tabs' => array(
        new PHPWord_Style_Tab("right", 9090)
    )
));

$PHPWord->addParagraphStyle('centerTab', array(
    'tabs' => array(
        new PHPWord_Style_Tab("center", 4680)
    )
));

// New portrait section
$section = $PHPWord->createSection();

// Add listitem elements
$section->addText("Multiple Tabs:\tOne\tTwo\tThree", NULL, 'multipleTab');
$section->addText("Left Aligned\tRight Aligned", NULL, 'rightTab');
$section->addText("\tCenter Aligned",            NULL, 'centerTab');

// Save File
$objWriter = PHPWord_IOFactory::createWriter($PHPWord, 'Word2007');
$objWriter->save('TabStops.docx');
?>

phpword's People

Contributors

ferdynator avatar mazahaca avatar theoboldt avatar kulak-at avatar sgehrig avatar

Watchers

 avatar Oliver Mueller avatar James Cloos avatar Timo Buhmann avatar  avatar Ivonne avatar

Forkers

a-fedyushin

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.