Showing posts with label XML. Show all posts
Showing posts with label XML. Show all posts

Monday, February 6, 2012

How to create a slide-show background

To create a slide-show background you need create a xml file and insert the information necessary.

If you go to /usr/share/backgrounds/cosmos/background-1.xml, you can see the configuration information necessary to run the background as slide-show.

Here is what it looks like:


<background>
  <starttime>
    <year>2012</year>
    <month>02</month>
    <day>06</day>
    <hour>00</hour>
    <minute>00</minute>
    <second>00</second>
  </starttime>
<!-- This animation will start at midnight. -->
  <static>
    <duration>1795.0</duration>
    <file>/usr/share/backgrounds/cosmos/cloud.jpg</file>
  </static>
  <transition>
    <duration>5.0</duration>
    <from>/usr/share/backgrounds/cosmos/cloud.jpg</from>
    <to>/usr/share/backgrounds/cosmos/comet.jpg</to>
  </transition>
  <static>
    <duration>1795.0</duration>
    <file>/usr/share/backgrounds/cosmos/comet.jpg</file>
  </static>
  <transition>
    <duration>5.0</duration>
    <from>/usr/share/backgrounds/cosmos/comet.jpg</from>
    <to>/usr/share/backgrounds/cosmos/earth-horizon.jpg</to>
  </transition>
  <static>
    <duration>1795.0</duration>
    <file>/usr/share/backgrounds/cosmos/earth-horizon.jpg</file>
  </static>
  <transition>
    <duration>5.0</duration>
    <from>/usr/share/backgrounds/cosmos/earth-horizon.jpg</from>
    <to>/usr/share/backgrounds/cosmos/blue-marble-west.jpg</to>
  </transition>
  <static>
    <duration>1795.0</duration>
    <file>/usr/share/backgrounds/cosmos/blue-marble-west.jpg</file>
  </static>
  <transition>
    <duration>5.0</duration>
    <from>/usr/share/backgrounds/cosmos/blue-marble-west.jpg</from>
    <to>/usr/share/backgrounds/cosmos/galaxy-ngc3370.jpg</to>
  </transition>
  <static>
    <duration>1795.0</duration>
    <file>/usr/share/backgrounds/cosmos/galaxy-ngc3370.jpg</file>
  </static>
  <transition>
    <duration>5.0</duration>
    <from>/usr/share/backgrounds/cosmos/galaxy-ngc3370.jpg</from>
    <to>/usr/share/backgrounds/cosmos/helix-nebula.jpg</to>
  </transition>
  <static>
    <duration>1795.0</duration>
    <file>/usr/share/backgrounds/cosmos/helix-nebula.jpg</file>
  </static>
  <transition>
    <duration>5.0</duration>
    <from>/usr/share/backgrounds/cosmos/helix-nebula.jpg</from>
    <to>/usr/share/backgrounds/cosmos/jupiter.jpg</to>
  </transition>
  <static>
    <duration>1795.0</duration>
    <file>/usr/share/backgrounds/cosmos/jupiter.jpg</file>
  </static>
  <transition>
    <duration>5.0</duration>
    <from>/usr/share/backgrounds/cosmos/jupiter.jpg</from>
    <to>/usr/share/backgrounds/cosmos/sombrero.jpg</to>
  </transition>
  <static>
    <duration>1795.0</duration>
    <file>/usr/share/backgrounds/cosmos/sombrero.jpg</file>
  </static>
  <transition>
    <duration>5.0</duration>
    <from>/usr/share/backgrounds/cosmos/sombrero.jpg</from>
    <to>/usr/share/backgrounds/cosmos/whirlpool.jpg</to>
  </transition>
  <static>
    <duration>1795.0</duration>
    <file>/usr/share/backgrounds/cosmos/whirlpool.jpg</file>
  </static>
  <transition>
    <duration>5.0</duration>
    <from>/usr/share/backgrounds/cosmos/whirlpool.jpg</from>
    <to>/usr/share/backgrounds/cosmos/cloud.jpg</to>
  </transition>
</background>



The static tag (<static>) allows show the specified image during x seconds.

The duration tag (<duration>)  must be specified in seconds. For example, if you want one hour to show a wallpaper, you must type 3600 (<duration>3600.0</duration>).

The transition tag (<transition>) also must be specified in seconds. This tag allows move to next file. Attention, don't forget to transition to first file when it is the last file.

The logic of XML file is:
  1. Transition from the previous image to the current image;
  2. Indicate the duration of the current image;
  3. Transition from the current image to the next image.
You can change the name of XML file but never can change .xml extension!








Tuesday, January 10, 2012

How to create a Word document with HTML & PHP

This post will explain how to create a Word document without third party software. The code will create a page with orientation landscape, view print and zoom 90% using HTML and PHP statements. 
Please ignore the page #2 after you have created a document Word.


HTML & PHP

<html
    xmlns:o='urn:schemas-microsoft-com:office:office'
    xmlns:w='urn:schemas-microsoft-com:office:word'
    xmlns='http://www.w3.org/TR/REC-html40'>
    <head>
        <title>Generate a document Word</title>
        <!--[if gte mso 9]-->
    <xml>
        <w:WordDocument>
            <w:View>Print</w:View>
            <w:Zoom>90</w:Zoom>
            <w:DoNotOptimizeForBrowser/>
        </w:WordDocument>
    </xml>
    <!-- [endif]-->
    <style>
        p.MsoFooter, li.MsoFooter, div.MsoFooter{
            margin: 0cm;
            margin-bottom: 0001pt;
            mso-pagination:widow-orphan;
            font-size: 12.0 pt;
            text-align: right;
        }


        @page Section1{
            size: 29.7cm 21cm;
            margin: 2cm 2cm 2cm 2cm;
            mso-page-orientation: landscape;
            mso-footer:f1;
        }
        div.Section1 { page:Section1;}
    </style>
</head>
<body>
    <div class="Section1">
        <h1>Hello World!</h1>
    <br clear=all style='mso-special-character:line-break;page-break-after:always' />
    <div style='mso-element:footer' id="f1">
        <p class=MsoFooter>
            Page <span style='mso-field-code:" PAGE "'></span>
        </p>
    </div>
</body>
</html>
<?php
header("Content-type: application/vnd.ms-word");
header("Content-Disposition: attachment;Filename=HelloWorld.doc");
?>






Tuesday, December 6, 2011

Using PHP and XSLT to Create a Word 2007 Document

You can use XSL Transformations (XSLT) to transform XML data into the Microsoft Office Open XML SDK 2.0 format that is used by Microsoft Office Word 2007, and make new Word 2007 documents from XML data. You can simplify transforming XML data into a Word 2007 document by starting with an existing Word 2007 document that has the desired layout.

Link

<a href="http://www.microsoft.com/?videoId=8184743c-dc7d-487a-bff5-b370b3c1f024&amp;from=mscomoffice&amp;src=v5:embed::" target="_new" title="Using PHP to Create Word 2007 Documents">Video: Using PHP to Create Word 2007 Documents</a>