这个xls有什么问题?

时间:2015-10-14 09:49:39

标签: excel phpexcel phpexcelreader

当我用Microsoft Excel打开这个xls时,会出现下一条消息:“proof.xls”的文件格式和扩展名不匹配。文件可能已损坏或不安全。除非您信任其源,否则不要打开它你还想打开吗?“

Microsoft Office无论如何都会打开文档并让我将其保存为新格式,但我需要“即时”重新编辑此文档(不使用Excel打开并保存文件步骤)以使用PHPExcel加载它。

这个文件来自一个自动网页生成器,我不知道它是如何编码xls的。

这是一个文件结构提取(只有第一行的表,不能在这里粘贴整个文件内容):

   <?xml version="1.0" encoding="ISO-8859-1"?>
    <Workbook xmlns="urn:schemas-microsoft-com:office:spreadsheet" xmlns:user="urn:my-scripts" xmlns:msxsl="urn:schemas-microsoft-com:xslt" xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:html="http://www.w3.org/TR/REC-html40" xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet" xmlns:x="urn:schemas-microsoft-com:office:excel" xmlns:o="urn:schemas-microsoft-com:office:office"><ExcelWorkbook xmlns="urn:schemas-microsoft-com:office:excel"><WindowHeight>9345</WindowHeight><WindowWidth>15180</WindowWidth><WindowTopX>120</WindowTopX><WindowTopY>60</WindowTopY><ProtectStructure>False</ProtectStructure><ProtectWindows>False</ProtectWindows></ExcelWorkbook><ss:Styles><ss:Style ss:Name="titulo" ss:ID="titulo"><NumberFormat ss:Format="@"/><Alignment ss:WrapText="0" ss:VerticalText="0" ss:Vertical="Center" ss:ShrinkToFit="0" ss:Rotate="0.0" ss:ReadingOrder="LeftToRight" ss:Indent="0" ss:Horizontal="Center"/><ss:Interior ss:Color="Automatic" ss:PatternColor="Automatic" ss:Pattern="None"/><ss:Protection x:HideFormula="
0" ss:Protected="0"/><ss:Font x:Family="Automatic" ss:VerticalAlign="None" ss:Underline="None" ss:StrikeThrough="0" ss:Size="14.0" ss:Shadow="0" ss:Outline="0" ss:Italic="0" ss:FontName="Arial" ss:Color="Automatic" ss:Bold="1"/></ss:Style><ss:Style ss:Name="subtitulo-negrita" ss:ID="subtitulo-negrita"><NumberFormat ss:Format="@"/><Alignment ss:WrapText="0" ss:VerticalText="0" ss:Vertical="Center" ss:ShrinkToFit="0" ss:Rotate="0.0" ss:ReadingOrder="LeftToRight" ss:Indent="0" ss:Horizontal="Left"/><ss:Interior ss:Color="Automatic" ss:PatternColor="Automatic" ss:Pattern="None"/><ss:Protection x:HideFormula="0" ss:Protected="0"/><ss:Font x:Family="Automatic" ss:VerticalAlign="None" ss:Underline="None" ss:StrikeThrough="0" ss:Size="12.0" ss:Shadow="0" ss:Outline="0" ss:Italic="0" ss:FontName="Arial" ss:Color="Automatic" ss:Bold="1"/></ss:Style><ss:Style ss:Name="subtitulo" ss:ID="subtitulo"><NumberFormat ss:Format="@"/><Alignment ss:WrapText="0" ss:VerticalText="0" ss:Vertical="Center" ss:ShrinkToFit="0" ss:
Rotate="0.0" ss:ReadingOrder="LeftToRight" ss:Indent="0" ss:Horizontal="Left"/><ss:Interior ss:Color="Automatic" ss:PatternColor="Automatic" ss:Pattern="None"/><ss:Protection x:HideFormula="0" ss:Protected="0"/><ss:Font x:Family="Automatic" ss:VerticalAlign="None" ss:Underline="None" ss:StrikeThrough="0" ss:Size="12.0" ss:Shadow="0" ss:Outline="0" ss:Italic="0" ss:FontName="Arial" ss:Color="Automatic" ss:Bold="0"/></ss:Style><ss:Style ss:Name="cabecera-tabla" ss:ID="cabecera-tabla"><NumberFormat ss:Format="@"/><Alignment ss:WrapText="0" ss:VerticalText="0" ss:Vertical="Center" ss:ShrinkToFit="0" ss:Rotate="0.0" ss:ReadingOrder="LeftToRight" ss:Indent="0" ss:Horizontal="Center"/><ss:Interior ss:Color="Automatic" ss:PatternColor="Automatic" ss:Pattern="None"/><ss:Protection x:HideFormula="0" ss:Protected="0"/><ss:Font x:Family="Automatic" ss:VerticalAlign="None" ss:Underline="None" ss:StrikeThrough="0" ss:Size="11.0" ss:Shadow="0" ss:Outline="0" ss:Italic="0" ss:FontName="Arial" ss:Color="Automatic" ss:Bold="1"
/></ss:Style><ss:Style ss:Name="contenido-tabla" ss:ID="contenido-tabla"><NumberFormat ss:Format="@"/><Alignment ss:WrapText="0" ss:VerticalText="0" ss:Vertical="Center" ss:ShrinkToFit="0" ss:Rotate="0.0" ss:ReadingOrder="LeftToRight" ss:Indent="0" ss:Horizontal="Center"/><ss:Interior ss:Color="Automatic" ss:PatternColor="Automatic" ss:Pattern="None"/><ss:Protection x:HideFormula="0" ss:Protected="0"/><ss:Font x:Family="Automatic" ss:VerticalAlign="None" ss:Underline="None" ss:StrikeThrough="0" ss:Size="10.0" ss:Shadow="0" ss:Outline="0" ss:Italic="0" ss:FontName="Arial" ss:Color="Automatic" ss:Bold="0"/></ss:Style></ss:Styles><Worksheet ss:Name="ACTIVITAT OCUPACIÓ"><ss:Table ss:DefaultColumnWidth="120" x:FullRows="1" x:FullColumns="1" ss:ExpandedRowCount="64000" ss:ExpandedColumnCount="500"><Row><Cell ss:MergeDown="0" ss:MergeAcross="4" ss:StyleID="titulo"><Data ss:Type="String">LLISTAT ACTIVITAT OCUPACIÓ</Data></Cell></Row><Row><Cell ss:MergeDown="0" ss:MergeAcross="0" ss:StyleID="subtitulo-negrita"><Data 
ss:Type="String">Data inicial</Data></Cell><Cell ss:MergeDown="0" ss:MergeAcross="0" ss:StyleID="subtitulo"><Data ss:Type="String">01/09/2015</Data></Cell><Cell ss:MergeDown="0" ss:MergeAcross="0" ss:StyleID="subtitulo"><Data ss:Type="String"/></Cell><Cell ss:MergeDown="0" ss:MergeAcross="0" ss:StyleID="subtitulo-negrita"><Data ss:Type="String">Data final</Data></Cell><Cell ss:MergeDown="0" ss:MergeAcross="0" ss:StyleID="subtitulo"><Data ss:Type="String">31/01/2016</Data></Cell></Row><Row><Cell ss:MergeDown="0" ss:MergeAcross="0" ss:StyleID="subtitulo-negrita"><Data ss:Type="String">Centre gestor</Data></Cell><Cell ss:MergeDown="0" ss:MergeAcross="3" ss:StyleID="subtitulo"><Data ss:Type="String">105 - Facultat de Ciències de la Comunicació</Data></Cell></Row><Row><Cell ss:MergeDown="0" ss:MergeAcross="0" ss:StyleID="subtitulo-negrita"><Data ss:Type="String">Edifici/s</Data></Cell><Cell ss:MergeDown="0" ss:MergeAcross="3" ss:StyleID="subtitulo"><Data ss:Type="String">Fac. Ciènc.  de la Comunicació</Data></
Cell></Row><Row><Cell ss:MergeDown="0" ss:MergeAcross="0" ss:StyleID="cabecera-tabla"><Data ss:Type="String">Data inicial</Data></Cell><Cell ss:MergeDown="0" ss:MergeAcross="0" ss:StyleID="cabecera-tabla"><Data ss:Type="String">Hora inicial</Data></Cell><Cell ss:MergeDown="0" ss:MergeAcross="0" ss:StyleID="cabecera-tabla"><Data ss:Type="String">Data final</Data></Cell><Cell ss:MergeDown="0" ss:MergeAcross="0" ss:StyleID="cabecera-tabla"><Data ss:Type="String">Hora final</Data></Cell><Cell ss:MergeDown="0" ss:MergeAcross="0" ss:StyleID="cabecera-tabla"><Data ss:Type="String">Total hores</Data></Cell><Cell ss:MergeDown="0" ss:MergeAcross="0" ss:StyleID="cabecera-tabla"><Data ss:Type="String">Espai</Data></Cell><Cell ss:MergeDown="0" ss:MergeAcross="0" ss:StyleID="cabecera-tabla"><Data ss:Type="String">Estudi</Data></Cell><Cell ss:MergeDown="0" ss:MergeAcross="0" ss:StyleID="cabecera-tabla"><Data ss:Type="String">Activitat</Data></Cell><Cell ss:MergeDown="0" ss:MergeAcross="0" ss:StyleID="cabecera-tabla"><Data 
ss:Type="String">Professor/Responsable</Data></Cell><Cell ss:MergeDown="0" ss:MergeAcross="0" ss:StyleID="cabecera-tabla"><Data ss:Type="String">Alumnes matriculats</Data></Cell><Cell ss:MergeDown="0" ss:MergeAcross="0" ss:StyleID="cabecera-tabla"><Data ss:Type="String">Observacions</Data></Cell></Row><Row><Cell ss:MergeDown="0" ss:MergeAcross="0" ss:StyleID="contenido-tabla"><Data ss:Type="String">01/09/2015</Data></Cell><Cell ss:MergeDown="0" ss:MergeAcross="0" ss:StyleID="contenido-tabla"><Data ss:Type="String">08:30</Data></Cell><Cell ss:MergeDown="0" ss:MergeAcross="0" ss:StyleID="contenido-tabla"><Data ss:Type="String">01/09/2015</Data></Cell><Cell ss:MergeDown="0" ss:MergeAcross="0" ss:StyleID="contenido-tabla"><Data ss:Type="String">21:00</Data></Cell><Cell ss:MergeDown="0" ss:MergeAcross="0" ss:StyleID="contenido-tabla"><Data ss:Type="Number">12.5</Data></Cell><Cell ss:MergeDown="0" ss:MergeAcross="0" ss:StyleID="contenido-tabla"><Data ss:Type="String">I/105EM/462</Data></Cell><Cell ss:MergeDown="0" 
ss:MergeAcross="0" ss:StyleID="contenido-tabla"><Data ss:Type="String"/></Cell><Cell ss:MergeDown="0" ss:MergeAcross="0" ss:StyleID="contenido-tabla"><Data ss:Type="String">02/09/2015</Data></Cell><Cell ss:MergeDown="0" ss:MergeAcross="0" ss:StyleID="contenido-tabla"><Data ss:Type="String">21:00</Data></Cell><Cell 
ss:MergeDown="0" ss:MergeAcross="0" ss:StyleID="contenido-tabla"><Data ss:Type="Number">12.5</Data></Cell><Cell ss:MergeDown="0" ss:MergeAcross="0" ss:StyleID="contenido-tabla"><Data ss:Type="String">I/105EM/462</Data></Cell><Cell ss:MergeDown="0" ss:MergeAcross="0" ss:StyleID="contenido-tabla"><Data ss:Type="String"/></Cell><Cell ss:MergeDown="0" ss:MergeAcross="0" ss:StyleID="contenido-tabla"><Data ss:Type="String">Màster DCEI</Data></Cell><Cell ss:MergeDown="0" ss:MergeAcross="0" ss:StyleID="contenido-tabla"><Data ss:Type="String">Chacon Garcia, Laura</Data></Cell><Cell ss:MergeDown="0" ss:MergeAcross="0" ss:StyleID="contenido-tabla"><Data ss:Type="Number">0</Data></Cell><Cell ss:MergeDown="0" ss:MergeAcross="0" ss:StyleID="contenido-tabla"><Data ss:Type="String"> </Data></Cell></Row>
</ss:Table><WorksheetOptions xmlns="urn:schemas-microsoft-com:office:excel"><PageSetup><Header x:Margin="0"/><Footer x:Margin="0"/><PageMargins x:Top="0.984251969" x:Right="0.78740157499999996" x:Left="0.78740157499999996" x:Bottom="0.984251969"/></PageSetup><Selected/><FreezePanes/><FrozenNoSplit/><SplitHorizontal>5</SplitHorizontal><TopRowBottomPane>5</TopRowBottomPane><ActivePane>2</ActivePane><Panes><Pane><Number>3</Number></Pane><Pane><Number>2</Number><ActiveRow>4</ActiveRow><ActiveCol>2</ActiveCol></Pane></Panes><ProtectObjects>False</ProtectObjects><ProtectScenarios>False</ProtectScenarios></WorksheetOptions></Worksheet></Workbook>

1 个答案:

答案 0 :(得分:1)

那是因为它不是.xls文件

.xls个文件是名为BIFF的二进制格式,位于OLE2包装器中。

您发布的部分文件是SpreadSheetML格式文件,这是Excel 2003引入的XML格式,但从未证明特别受欢迎,后来被OfficeOpenXML(.xlsx)格式取代

这是一种有效的电子表格格式,MS Excel完全能够阅读,但它不是BIFF格式,因此抱怨扩展名与格式不符。

将扩展名更改为.xml,然后在MS Excel中阅读。