A simple example of a Word file generated by PHP

Source: Internet
Author: User
  1. /**

  2. PHP generates Word files
  3. link:bbs.it-home.org
  4. */
  5. $word = new COM ("Word.Application") or Die ("Cannot Start Word program! ");

  6. $word->visible = 0;

  7. $n = $word->documents->add ();

  8. # # sub-section symbol

  9. $n->sections->add ($word->selection->range,0);

  10. # # Sections (1) first section

  11. $s 1= $n->sections (1);
  12. $s 1->pagesetup->bottommargin=10;

  13. # # Paragraphs (1) first paragraph

  14. $s 1->range->insertbefore ("the first of the Penguin Empire-poetry multi-typesetting test");
  15. $s 1->range->insertparagraphafter;
  16. $s 1->range->insertbefore ("big title-poem Song Fu \ \");

  17. $Para = $n->paragraphs (1);

  18. $Para->alignment=1;
  19. $font _style= $Para->range;
  20. $font _style->font->size = 14;
  21. $font _style->font->name= "marked in italics";

  22. $Para = $n->paragraphs (2);

  23. $Para->alignment=2;
  24. $font _style= $Para->range;
  25. $font _style->font->size = 10;
  26. $font _style->font->name= "New fine Ming Body";

  27. $p = $n->sections (2);

  28. $obj = $p->pagesetup;
  29. $Col = $obj->textcolumns;
  30. $Col->setcount (2);

  31. $p->range->insertafter ("

  32. Xi Murong

  33. Like a seed that blows with the wind

  34. I think I might have lost my way.
  35. This world is never
  36. The blueprint that was promised to me

  37. But there's tears in my eyes

  38. Looking for the old self and out of the crowd
  39. Sprinkled on the trails, there are already
  40. My dream in the dark grows in the forest
  41. My longing and my Love
  42. Blooming and disappearing like a flower.

  43. And in the shadow of the scent of the waters

  44. And keep my innocent heart.

  45. Keep all I have.

  46. I'm afraid but I can't change
  47. Footprints

  48. Pan-jiang fried tea with sushi

  49. Burying still cooking

  50. From the fishing stone to the deep clear
  51. Big gourd Storage month return Spring urn
  52. Small ladle of river at night bottle
  53. The snow milk has been fried at the foot
  54. The song of the Wind and the sound of diarrhea
  55. Clears is not easy to ban three bowls
  56. The trees in the deserted city are more

  57. Two ou tea Bai Juyi

  58. The awakening of a food strike

  59. Get up two ou tea
  60. Jutou to see the Shadow of Japan
  61. has been re-southwest oblique
  62. Happy people cherish the day to promote
  63. Worry about the rest of the year
  64. No worries, no joy.
  65. Long term career

  66. Spring Fried tea has Waibergui

  67. Sit and cool water

  68. Look at the frying dust.
  69. Hungry holding a bowl
  70. Send and love tea people

  71. A word to seven words poem tea Yuan Zhen

  72. Tea

  73. Fragrant leaf buds
  74. The poet loves the monk home
  75. Crushed white jade weave red yarn
  76. Motozuki pan-fried Huangli-color bowl with curved dust flowers
  77. After the night to accompany the moon morning before life to the sunrise
  78. Wash the ancient and modern people tirelessly will be drunk after the praise

  79. ");

  80. $word->defaultsaveformat= ""; # # archive mode, default doc

  81. $word->documents[1]->saveas ("C:\\word.doc");
  82. $word->quit ();
  83. $word->release ();
  84. $word = null;
  85. ?>

Copy Code
  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.