[ Поиск ] - [ Пользователи ] - [ Календарь ]
Полная Версия: Перевести сформировании таблицу из php в xml
felx
Здравствуйте Уважаемее форумчани. Не получается сформировать запрос для xml. Ситуация таково из БД php формирует таблице в виде

---------------------------------------
| name | daten1 | daten2 | date3 |
----------------------------------------
| name1 | date12 | date13 | date14 |
| name21 | date22 | date23 | date24 |
| name31 | date32 | date33 | date34 |


Вот таблица формирована а теперь немого экспортировать этот таблице в xml. Шапку формы и нежнее части я сформировал но вот я получается где уже идет от name1 до date34

В php коде я тока мог прорисать шапку и нежней часть формы.


<?php
require_once "Writer.php";

// Create workbook
$xls =& new Spreadsheet_Excel_Writer();

// Create worksheet
$cart =& $xls->addWorksheet('new_xml');

# Add the title
// Some text to use as a title for the worksheet

$titleText = 'Nazavaniya tablitste ';

// Create a format object
$titleFormat =& $xls->addFormat();

// Set the font family - Helvetica works for OpenOffice calc too...
$titleFormat->setFontFamily('Helvetica');

// Set the text to bold
$titleFormat->setBold();

// Set the text size
$titleFormat->setSize('13');

// Set the text color
$titleFormat->setColor('navy');

// Set the bottom border width to "thick"
$titleFormat->setBottom(2);

// Set the color of the bottom border
$titleFormat->setBottomColor('navy');

// Set the alignment to the special merge value
$titleFormat->setAlign('merge');

// Add the title to the top left cell of the worksheet,
// passing it the title string and the format object

$cart->write(0,0,'',$titleFormat);

// Add three empty cells to merge with
$cart->write(0,1,'',$titleFormat);
$cart->write(0,2,$titleText,$titleFormat);
$cart->write(0,3,'',$titleFormat);
$cart->write(0,4,'',$titleFormat);

// The the row height
$cart->setRow(0,30);

// Set the column width for the first 4 columns
$cart->setColumn(0,3,15);

# Add the column headings
// Set up some formatting

$colHeadingFormat =& $xls->addFormat();
$colHeadingFormat->setBold();
$colHeadingFormat->setFontFamily('Helvetica');
$colHeadingFormat->setSize('10');
$colHeadingFormat->setAlign('center');

// An array with the data for the column headings
$colNames = array('name','daten1','daten2','daten3');
$cart->writeRow(2,0,$colNames,$colHeadingFormat);

// The cell group to freeze
// 1st Argument - vertical split position
// 2st Argument - horizontal split position (0 = no horizontal split)
// 3st Argument - topmost visible row below the vertical split
// 4th Argument - leftmost visible column after the horizontal split

$freeze = array(3,0,4,0);

// Freeze those cells!
$cart->freezePanes($freeze);

// Send the Spreadsheet to the browser
$xls->send("phpPetstore.xls");
$xls->close();
?>
Быстрый ответ:

 Графические смайлики |  Показывать подпись
Здесь расположена полная версия этой страницы.
Invision Power Board © 2001-2024 Invision Power Services, Inc.