Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?
- class XML{
- public $HND;
- public $row;
- function Worksheet_Init($title){
- $this->row=0;
- //ss:ExpandedRowCount="9"
- fwrite($this->HND,'<Worksheet ss:Name="'.$title.'">
- <Table ss:ExpandedColumnCount="12" x:FullColumns="1"
- x:FullRows="1" ss:StyleID="s21" ss:DefaultRowHeight="14.55">
- <Column ss:StyleID="s21" ss:AutoFitWidth="0" ss:Width="43"/>
- <Column ss:StyleID="s21" ss:AutoFitWidth="0" ss:Width="81"/>
- <Column ss:StyleID="s21" ss:AutoFitWidth="0" ss:Width="270"/>
- <Column ss:StyleID="s21" ss:AutoFitWidth="0" ss:Width="49"/>
- <Column ss:StyleID="s21" ss:AutoFitWidth="0" ss:Width="50"/>
- <Column ss:StyleID="s21" ss:AutoFitWidth="0" ss:Width="48" ss:Span="6"/>
- <Row ss:AutoFitHeight="0" ss:Height="25.8">
- <Cell ss:MergeAcross="11" ss:StyleID="s23"><Data ss:Type="String">LOGO</Data></Cell>
- </Row>
- <Row ss:AutoFitHeight="0">
- <Cell ss:MergeAcross="11" ss:StyleID="s25"><Data ss:Type="String">тел: </Data></Cell>
- </Row>
- <Row ss:AutoFitHeight="0">
- <Cell ss:MergeAcross="11" ss:StyleID="s25"><Data ss:Type="String">Наш адрес: </Data></Cell>
- </Row>
- <Row ss:AutoFitHeight="0">
- <Cell ss:MergeAcross="11"/>
- </Row>
- <Row ss:AutoFitHeight="0">
- <Cell ss:StyleID="s27"><Data ss:Type="String">Склад</Data></Cell>
- <Cell ss:StyleID="s27"><Data ss:Type="String">Артикул</Data></Cell>
- <Cell ss:StyleID="s27"><Data ss:Type="String">Наименование</Data></Cell>
- <Cell ss:StyleID="s27"><Data ss:Type="String">Бренд</Data></Cell>
- <Cell ss:StyleID="s27"><Data ss:Type="String">Количество</Data></Cell>
- <Cell ss:StyleID="s27"><Data ss:Type="String">Цена</Data></Cell>
- </Row>');
- }
- function Worksheet_End($option=''){
- fwrite($this->HND,'</Table>
- <WorksheetOptions xmlns="urn:schemas-microsoft-com:office:excel">
- <FreezePanes/>
- <FrozenNoSplit/>
- <SplitHorizontal>5</SplitHorizontal>
- <TopRowBottomPane>5</TopRowBottomPane>
- <ActivePane>2</ActivePane>
- <Panes>
- <Pane>
- <Number>3</Number>
- </Pane>
- <Pane>
- <Number>2</Number>
- <ActiveCol>0</ActiveCol>
- </Pane>
- </Panes>
- </WorksheetOptions>
- <AutoFilter x:Range="R5C1:R65505C6"
- xmlns="urn:schemas-microsoft-com:office:excel">
- </AutoFilter>
- </Worksheet>');
- /*
- fwrite($this->HND,'</Table>
- <WorksheetOptions xmlns="urn:schemas-microsoft-com:office:excel">
- <PageSetup>
- <PageMargins x:Bottom="0.984251969" x:Left="0.78740157499999996"
- x:Right="0.78740157499999996" x:Top="0.984251969"/>
- </PageSetup>
- <Unsynced/>
- '.$option.'
- <FreezePanes/>
- <FrozenNoSplit/>
- <SplitHorizontal>5</SplitHorizontal>
- <TopRowBottomPane>5</TopRowBottomPane>
- <ActivePane>2</ActivePane>
- <Panes>
- <Pane>
- <Number>3</Number>
- </Pane>
- <Pane>
- <Number>2</Number>
- </Pane>
- </Panes>
- <ProtectObjects>False</ProtectObjects>
- <ProtectScenarios>False</ProtectScenarios>
- </WorksheetOptions>
- <AutoFilter x:Range="R5C1:R65505C6"
- xmlns="urn:schemas-microsoft-com:office:excel">
- </AutoFilter>
- </Worksheet>');*/
- }
- function Worksheet_ROW($stock,$art,$name,$brand,$count,$price){
- if($this->row<65531){fwrite($this->HND,'<Row ss:AutoFitHeight="0">
- <Cell ss:StyleID="s28"><Data ss:Type="String">'.$stock.'</Data></Cell>
- <Cell ss:StyleID="s28"><Data ss:Type="String">'.$art.'</Data></Cell>
- <Cell ss:StyleID="s28"><Data ss:Type="String">'.$name.'</Data></Cell>
- <Cell ss:StyleID="s28"><Data ss:Type="String">'.$brand.'</Data></Cell>
- <Cell ss:StyleID="s28"><Data ss:Type="'.(is_int($count)?'Number':'String').'">'.$count.'</Data></Cell>
- <Cell ss:StyleID="s29"><Data ss:Type="Number">'.$price.'</Data></Cell>
- </Row>');
- return $this->row++;
- }return -1;
- }
- function XML($filename,$option=''){
- /*header("Content-Type:application/vnd.ms-excel");
- header("Content-Disposition:attachment;filename=price.xls");*/
- $this->HND=fopen($filename,'w');
- if($this->HND===false)exit('FILE');
- fwrite($this->HND,'<?xml version="1.0"?>
- <?mso-application progid="Excel.Sheet"?>
- <Workbook xmlns="urn:schemas-microsoft-com:office:spreadsheet"
- xmlns:o="urn:schemas-microsoft-com:office:office"
- xmlns:x="urn:schemas-microsoft-com:office:excel"
- xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet"
- xmlns:html="http://www.w3.org/TR/REC-html40">');
- fwrite($this->HND,'<DocumentProperties xmlns="urn:schemas-microsoft-com:office:office">
- <Title>Price</Title>
- <Author>Price</Author>
- <LastAuthor>price</LastAuthor>
- <LastPrinted>'.date('Y-m-d').'T'.date('H:i:s').'Z</LastPrinted>
- <Created>'.date('Y-m-d').'T'.date('H:i:s').'Z</Created>
- <LastSaved>'.date('Y-m-d').'T'.date('H:i:s').'Z</LastSaved>
- <Version>11.9999</Version>
- </DocumentProperties>
- <OfficeDocumentSettings xmlns="urn:schemas-microsoft-com:office:office">
- <Colors>
- <Color>
- <Index>2</Index>
- <RGB>#E7EBDA</RGB>
- </Color>
- <Color>
- <Index>3</Index>
- <RGB>#686868</RGB>
- </Color>
- </Colors>
- </OfficeDocumentSettings>
- <ExcelWorkbook xmlns="urn:schemas-microsoft-com:office:excel">
- <WindowHeight>5496</WindowHeight>
- <WindowWidth>9660</WindowWidth>
- <WindowTopX>0</WindowTopX>
- <WindowTopY>0</WindowTopY>
- <ProtectStructure>False</ProtectStructure>
- <ProtectWindows>False</ProtectWindows>'.$option.'
- </ExcelWorkbook>
- <Styles>
- <Style ss:ID="Default" ss:Name="Normal">
- <Alignment ss:Horizontal="Left" ss:Vertical="Bottom"/>
- <Borders/>
- <Font ss:FontName="Calibri" ss:Size="11" ss:Color="#000000"/>
- <NumberFormat/>
- </Style>
- <Style ss:ID="s21">
- <Interior/>
- <Protection/>
- </Style>
- <Style ss:ID="s23">
- <Font ss:FontName="Calibri" x:CharSet="204" x:Family="Swiss" ss:Size="24"
- ss:Color="#FF6600"/>
- <Interior/>
- <Protection/>
- </Style>
- <Style ss:ID="s25">
- <Font ss:FontName="Calibri" ss:Size="11" ss:Color="#000000" ss:Bold="1"/>
- <Interior/>
- <Protection/>
- </Style>
- <Style ss:ID="s27">
- <Borders>
- <Border ss:Position="Bottom" ss:LineStyle="Continuous" ss:Weight="1"
- ss:Color="#686868"/>
- <Border ss:Position="Left" ss:LineStyle="Continuous" ss:Weight="1"
- ss:Color="#686868"/>
- <Border ss:Position="Right" ss:LineStyle="Continuous" ss:Weight="1"
- ss:Color="#686868"/>
- <Border ss:Position="Top" ss:LineStyle="Continuous" ss:Weight="1"
- ss:Color="#686868"/>
- </Borders>
- <Font ss:FontName="Times New Roman" ss:Size="9" ss:Color="#000000" ss:Bold="1"/>
- <Interior ss:Color="#E7EBDA" ss:Pattern="Solid"/>
- <Protection/>
- </Style>
- <Style ss:ID="s28">
- <Borders>
- <Border ss:Position="Bottom" ss:LineStyle="Continuous" ss:Weight="1"
- ss:Color="#686868"/>
- <Border ss:Position="Left" ss:LineStyle="Continuous" ss:Weight="1"
- ss:Color="#686868"/>
- <Border ss:Position="Right" ss:LineStyle="Continuous" ss:Weight="1"
- ss:Color="#686868"/>
- <Border ss:Position="Top" ss:LineStyle="Continuous" ss:Weight="1"
- ss:Color="#686868"/>
- </Borders>
- <Interior/>
- <Protection/>
- </Style>
- <Style ss:ID="s29">
- <Borders>
- <Border ss:Position="Bottom" ss:LineStyle="Continuous" ss:Weight="1"
- ss:Color="#686868"/>
- <Border ss:Position="Left" ss:LineStyle="Continuous" ss:Weight="1"
- ss:Color="#686868"/>
- <Border ss:Position="Right" ss:LineStyle="Continuous" ss:Weight="1"
- ss:Color="#686868"/>
- <Border ss:Position="Top" ss:LineStyle="Continuous" ss:Weight="1"
- ss:Color="#686868"/>
- </Borders>
- <Interior/>
- <Protection/>
- </Style>
- </Styles>');
- }
- function __destruct(){
- fwrite($this->HND,'</Workbook>');
- fclose($this->HND);
- }
- }
- $XMLList=new XML($GLOBALS['patchTMP']."/A-z.xls");//доп лист
- $XMLList->Worksheet_Init('A-z');
- $XMLList->Worksheet_ROW($row['STOCK'],$row['ART'],$row['NAME'],$row['BRAND'],$row['COUNTS'],$row['PRICE']);
- $XMLList->Worksheet_End();
- unset($XMLList);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement