konto usunięte

Temat: Wydruk XML (XSL->Excel) polskie znaki

Witam,

Tworzę wydruk XML, przenoszący DataSet do formatu Excelowskiego. Mam problem z kodowaniem polskich znaków. Otóż otrzymując wynikowy arkusz excelowski, otrzymuję krzaczki w miejsce polskich liter. Zauważyłem, jednak iż problem pojawia się wraz z rozrostem struktury tabelarycznej(jedna tabela, badź tabelki pod sobą nie powodują generowania tego błędu), w której zapisuje DataSet. Poniżej kod, byłbym wdzięczny za wszelkie wskazówki.

pzdr


[SQL]
tu jakas procedura sql;)

[XSL]
<?xml version="1.0" encoding="iso-8859-1"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:msxsl="urn:schemas-microsoft-com:xslt"
xmlns:usr="urn:the-xml-files:xslt" >
<xsl:output omit-xml-declaration="yes" method="html" version="1.0" encoding="utf-16" indent="yes"/>
<xsl:preserve-space elements="*"/>
<xsl:template match="/">
<xsl:for-each select="ROOT">
<xsl:apply-templates select="RECORDSET1"/>
</xsl:for-each>
</xsl:template>

<xsl:template match="RECORDSET1">
<xsl:apply-templates select="RECORD" mode="r1"/>
</xsl:template>

<xsl:template match="RECORD" mode="r1">
<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">
<Worksheet ss:Name="Sheet1">
<TABLE>
<TR>
<TD>
<TABLE>
<TR>
<TD></TD>
<TD colspan="4">
<font face="Times New Roman" size="2"><Data ss:Type="String"><xsl:value-of select="@frm_nazwa1"/></Data></font>
</TD>
</TR>
<TR>
<TD></TD>
<TD>
<font face="Times New Roman" size="2"><Data ss:Type="String"><xsl:value-of select="@frm_nazwa2"/></Data></font>
</TD>
</TR>
<TR>
<TD></TD>
<TD colspan="4">
<font face="Times New Roman" size="2"><Data ss:Type="String"><xsl:value-of select="@frm_nazwa3"/></Data></font>
</TD>
</TR>
<TR>
<TD></TD>
<TD colspan="4">
<font face="Times New Roman" size="2"><Data ss:Type="String"><xsl:value-of select="@frm_miasto"/></Data></font>
</TD>
</TR>
<TR>
<TD></TD>
<TD colspan="4">
<font face="Times New Roman" size="2"><Data ss:Type="String"><xsl:value-of select="@frm_ulica"/></Data></font>
</TD>
</TR>
<TR>
<TD></TD>
<TD colspan="4">
<font face="Times New Roman" size="2"><Data ss:Type="String"><xsl:value-of select="@frm_nip"/></Data></font>
</TD>
</TR>
<TR>
<TD></TD>
<TD colspan="4">
<font face="Times New Roman" size="2"><Data ss:Type="String"><xsl:value-of select="@frm_telefon"/></Data></font>
</TD>
</TR>
<TR>
<TD></TD>
<TD>
<font face="Times New Roman" size="2"><Data ss:Type="String"><xsl:value-of select="@frm_fax"/></Data></font>
</TD>
</TR>
</TABLE>
</TD>
<TD>
<TABLE>
<TR>
<TD colspan="6" bgcolor="silver">
<font face="Times New Roman" size="3"><B><p align="center">Zlecenie Wydania</p></B></font>
</TD>
</TR>
<TR>
<TD colspan="6">
<font face="Times New Roman" size="3"><B><p align="center"><Data ss:Type="String"><xsl:value-of select="@numerDokumentu"/></Data></p></B></font>
</TD>
</TR>
<TR>
<TD>
<font face="Times New Roman" size="2">Data wystawienia:</font>
</TD>
<TD>
<font face="Times New Roman" size="2"><B><Data ss:Type="String"><xsl:value-of select="@dataWystawienia"/></Data></B></font>
</TD>
</TR>
<TR>
<TD>
<font face="Times New Roman" size="2">Data realizacji:</font>
</TD>
<TD>
<font face="Times New Roman" size="2"><B><Data ss:Type="String"><xsl:value-of select="@dataRealizacji"/></Data></B></font>
</TD>
</TR>
<TR>
<TD>
<font face="Times New Roman" size="2"><Data ss:Type="String"><xsl:value-of select="@magKod"/></Data></font>
</TD>
</TR>
</TABLE>
</TD>
</TR>
</TABLE>
<TABLE>
<TR><TD></TD></TR>
<TR><TD></TD></TR>
<TR><TD></TD></TR> </TABLE>
<TABLE>
<TR>
<TD></TD>
<TD>
<font face="Times New Roman" size="2">Zamawiajacy:</font>
</TD>
<TD colspan="6">
<font face="Times New Roman" size="2">Wysyłka do:</font>
</TD>
</TR>
<TR>
<TD></TD>
<TD>
ĄĄĄąą
</TD>
<TD>
s
</TD>
</TR>
</TABLE>

</Worksheet>

</Workbook>
</xsl:template>
<xsl:template match="RECORDSET1">
<xsl:apply-templates select="RECORD" mode="r1"/>
</xsl:template>

</xsl:stylesheet>

[RUN]
excel.exe

Mateusz H. edytował(a) ten post dnia 16.09.11 o godzinie 10:31

konto usunięte

Temat: Wydruk XML (XSL->Excel) polskie znaki

ok, udalo się rozwiązać, poniżej kod. niepoprawny układ xls generował błąd.


[SQL]
tutaj procka;)

[XSL]
<?xml version="1.0" encoding="windows-1250"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet" version="1.0">
<xsl:output method = "xml" omit-xml-declaration="yes" encoding="windows-1250" doctype-public="-//W3C//DTD XHTML 1.1//EN" doctype-system="http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd" />
<xsl:preserve-space elements="*"/>


<xsl:template match="/">

<xsl:value-of disable-output-escaping="yes" select="string('<?xml version="1.0" encoding="windows-1250"?>')"/>
<?xml version="1.0" encoding="windows-1250"?>
<?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">
<DocumentProperties xmlns="urn:schemas-microsoft-com:office:office">
<Author>mh</Author>
<LastAuthor></LastAuthor>
<Created>2011-06-16T23:04:04Z</Created>
<Company>xx</Company>
<Version>01</Version>
</DocumentProperties>
<ExcelWorkbook xmlns="urn:schemas-microsoft-com:office:excel">
<WindowHeight>6795</WindowHeight>
<WindowWidth>8460</WindowWidth>
<WindowTopX>120</WindowTopX>
<WindowTopY>15</WindowTopY>
<ProtectStructure>False</ProtectStructure>
<ProtectWindows>False</ProtectWindows>
</ExcelWorkbook>
<Styles>
<Style ss:ID="Default" ss:Name="Normal">
<Alignment ss:Vertical="Bottom" />
<Borders />
<Font />
<Interior />
<NumberFormat />
<Protection />
</Style>
<Style ss:ID="s21">
<Font ss:FontName="Times New Roman" ss:Size="10" />
</Style>
<Style ss:ID="s22">
<Font ss:FontName="Times New Roman" ss:Size="12" ss:Bold="1" />
<Interior ss:Color="Silver" ss:Pattern="Solid" ss:PatternColor="Silver"/>
<Alignment ss:Horizontal="Center" />
</Style>
<Style ss:ID="s23">
<Font ss:FontName="Times New Roman" ss:Size="12" />
<Alignment ss:Horizontal="Center" />
</Style>
</Styles>
<Worksheet ss:Name="ZlecenieWydania">
<Table>
<xsl:for-each select="ROOT/RECORDSET1/RECORD">
<Column ss:AutoFitWidth="0"/>
<Column ss:AutoFitWidth="0" ss:Width="100"/>
<Column ss:AutoFitWidth="0" ss:Width="200"/>
<Column ss:AutoFitWidth="0"/>
<Column ss:AutoFitWidth="0" ss:Width="300"/>
<Row>
<Cell></Cell>
<Cell ss:StyleID="s21">
<Data ss:Type="String"><xsl:value-of select="@frm_nazwa1"/></Data>
</Cell>
<Cell></Cell>
<Cell></Cell>
<Cell ss:StyleID="s22">
<Data ss:Type="String">Zlecenie wydania</Data>
</Cell>
</Row>
<Row>
<Cell></Cell>
<Cell ss:StyleID="s21">
<Data ss:Type="String"><xsl:value-of select="@frm_nazwa2"/></Data>
</Cell>
<Cell></Cell>
<Cell></Cell>
<Cell ss:StyleID="s23">
<Data ss:Type="String"><xsl:value-of select="@numerDokumentu"/></Data>
</Cell>
</Row>
<Row>
<Cell></Cell>
<Cell ss:StyleID="s21">
<Data ss:Type="String"><xsl:value-of select="@frm_nazwa3"/></Data>
</Cell>
<Cell></Cell>
<Cell></Cell>
</Row>
<Row>
<Cell></Cell>
<Cell ss:StyleID="s21">
<Data ss:Type="String"><xsl:value-of select="@frm_miasto"/></Data>
</Cell>
<Cell></Cell>
<Cell></Cell>
<Cell ss:StyleID="s21">
<Data ss:Type="String">Data wystawienia: <B><xsl:value-of select="@dataWystawienia"/></B></Data>
</Cell>
</Row>
<Row>
<Cell></Cell>
<Cell ss:StyleID="s21">
<Data ss:Type="String"><xsl:value-of select="@frm_ulica"/></Data>
</Cell>
<Cell></Cell>
<Cell></Cell>
<Cell ss:StyleID="s21">
<Data ss:Type="String">Data realizcji: <B><xsl:value-of select="@dataRealizacji"/></B></Data>
</Cell>
</Row>
<Row>
<Cell></Cell>
<Cell ss:StyleID="s21">
<Data ss:Type="String"><xsl:value-of select="@frm_nip"/></Data>
</Cell>
<Cell></Cell>
<Cell></Cell>
</Row>
<Row>
<Cell></Cell>
<Cell ss:StyleID="s21">
<Data ss:Type="String"><xsl:value-of select="@frm_telefon"/></Data>
</Cell>
<Cell></Cell>
<Cell></Cell>
<Cell ss:StyleID="s21">
<Data ss:Type="String">Magazyn: <B><xsl:value-of select="@magKod"/></B></Data>
</Cell>
</Row>
<Row>
<Cell></Cell>
<Cell ss:StyleID="s21">
<Data ss:Type="String"><xsl:value-of select="@frm_fax"/></Data>
</Cell> <Cell></Cell>
<Cell></Cell> </Row>
<Row>
</Row>
<Row>
</Row>
<Row>
<Cell></Cell>
<Cell ss:StyleID="s21">
<Data ss:Type="String">Zamawiający</Data>
</Cell>
</Row>
</xsl:for-each>
</Table> </Worksheet> <WorksheetOptions xmlns="urn:schemas-microsoft-com:office:excel">
<Print>
<ValidPrinterInfo />
<HorizontalResolution>600</HorizontalResolution>
<VerticalResolution>600</VerticalResolution>
</Print>
<Selected />
<Panes>
<Pane>f
<Number>3</Number>
<ActiveRow>5</ActiveRow>
<ActiveCol>1</ActiveCol>
</Pane>
</Panes>
<ProtectObjects>False</ProtectObjects>
<ProtectScenarios>False</ProtectScenarios>
</WorksheetOptions>
</Workbook>

</xsl:template>


<xsl:template match="RECORDSET1">
<xsl:apply-templates select="RECORD" mode="r1"/>
</xsl:template>

<xsl:template match="RECORD" mode="r1">

<xsl:value-of select="@frm_nazwa1"/>
</xsl:template>

</xsl:stylesheet>


[RUN]
excel.exe


Mateusz H. edytował(a) ten post dnia 16.09.11 o godzinie 20:33

Następna dyskusja:

Wydruk XML Dynamiczne kolumny




Wyślij zaproszenie do