Giter VIP home page Giter VIP logo

docx's Introduction

Docx Parser

This PHP based parser takes any docx file, and creates a PHP array containing its structure, content & style information. Simply import any style data (as demonstrated within index.php) using the word style name & any desired attributes and run the parser.

====

Supports:

  • Word styles
  • Paragraphs
  • Text indentation / tabbing
  • Nested lists (& inline lists)
  • Tables (Vertical cell merging + colspans)
  • Images (& finding the required image size)
  • Hyperlinks (With mailto: support)
  • Bold / Underlined / Italic text
  • Textboxes (Parser support added, but not rendered)
  • Table of content functionality (You likely need to extend the docx class & modify the ->render() class)

====

Known Bugs:

  • Tables cells that us the following pattern don't render properly:
Example (incorrect render)
cell 1
cell 2
--------
cell 3
cell 4

Cell 1 + 2 are vertically merged. Then there is a border, cell 3 + 4 are merged. The renderer cannot differentiate between multiple vertical merges that don't have a standard cell between them.

The following layout is fine, as cell 3 is a standard cell dividing the two vertical merges:

Example (works)
cell 1
cell 2
--------
cell 3
--------
cell 4
cell 5

====

Caveats:

  • Images are displayed at the same dimensions as in word, however the included rendering class does not contain functionality for resizing the raw image files as required (due to it being out of scope for this project)
  • The parser may take some time to run on larger documents
  • Modifying text in word to look the same as a header style is not the same as setting its stylename to 'header'

====

Requirements:

  • PHP 5.3 or greater
  • /tmp writable by PHP

docx's People

Contributors

philgale92 avatar

Watchers

 avatar  avatar

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.