I have a xml spreadsheetml document. This is used to create an excel document through my silverlight application. When the file created through this template is saved as *.xlsx Excel 2010 throws an error
"Excel cannot open file '*.xlsx' because the file format or extension is not valid. Verify that the file has not been corrupted and that the file extension matches the format of the file."
However, if the file is saved as .xls or .xml then there is no problem and it can be opened through Excel 2010.
<?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">
<DocumentProperties xmlns="urn:schemas-microsoft-com:office:office">
<Author></Author>
<LastAuthor></LastAuthor>
<Created>2010-10-25T14:17:17Z</Created>
<LastSaved>2010-10-25T14:17:17Z</LastSaved>
<Company></Company>
<Version></Version>
</DocumentProperties>
<ExcelWorkbook xmlns="urn:schemas-microsoft-com:office:excel">
<WindowHeight>12015</WindowHeight>
<WindowWidth>20055</WindowWidth>
<WindowTopX>480</WindowTopX>
<WindowTopY>150</WindowTopY>
<ProtectStructure>False</ProtectStructure>
<ProtectWindows>False</ProtectWindows>
</ExcelWorkbook>
<Styles>
<Style ss:ID="Default" ss:Name="Normal">
<Alignment ss:Horizontal="Left" ss:Vertical="Center"/>
<Borders/>
<Font ss:Color="#000000"/>
<Interior ss:Color="#FFFFFF" ss:Pattern="Solid"/>
<NumberFormat/>
<Protection/>
</Style>
<Style ss:ID="s21">
<NumberFormat ss:Format="Short Date"/>
</Style>
<Style ss:ID="s22">
<NumberFormat ss:Format="0"/>
</Style>
</Styles>
<Worksheet ss:Name="Sheet1">
<Table>
***
</Table>
</Worksheet>
</Workbook>
How can this template be upgraded to match the Excel 2010 format?
This warning is a result of Extension Hardening in Excel 2007+.
How can this template be upgraded to match the Excel 2010 format?
It can't be upgraded without using some external application that understands both formats. The SpreadsheetXML and XLSX formats are very different.
Related
I need to create code in Swift for iOS device, to create and save a local XML file. It's actually a KML file with waypoints for exporting to Google earth.
I found the API reference here: API Reference - Class - XMLDocument
But it lacks an example of how to use these functions. Other examples I find online are all in objective C, so I'm lost how to write the code.
If someone can show simple example of how to create the file and add some keys, childs etc, that would be awesome.
An example of what this KML output file will look like:
<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://www.opengis.net/kml/2.2" xmlns:gx="http://www.google.com/kml/ext/2.2" xmlns:kml="http://www.opengis.net/kml/2.2" xmlns:atom="http://www.w3.org/2005/Atom">
<Document>
<name>Waypoint Name.kml</name>
<StyleMap id="msn_ylw-pushpin">
<Pair>
<key>normal</key>
<styleUrl>#sn_ylw-pushpin</styleUrl>
</Pair>
<Pair>
<key>highlight</key>
<styleUrl>#sh_ylw-pushpin</styleUrl>
</Pair>
</StyleMap>
<Style id="sn_ylw-pushpin">
<IconStyle>
<scale>1.1</scale>
<Icon>
<href>http://maps.google.com/mapfiles/kml/pushpin/ylw-pushpin.png</href>
</Icon>
<hotSpot x="20" y="2" xunits="pixels" yunits="pixels"/>
</IconStyle>
<ListStyle>
</ListStyle>
</Style>
<Style id="sh_ylw-pushpin">
<IconStyle>
<scale>1.3</scale>
<Icon>
<href>http://maps.google.com/mapfiles/kml/pushpin/ylw-pushpin.png</href>
</Icon>
<hotSpot x="20" y="2" xunits="pixels" yunits="pixels"/>
</IconStyle>
<ListStyle>
</ListStyle>
</Style>
<Placemark>
<name>Waypoint Name</name>
<description>Description</description>
<LookAt>
<longitude>-114.4379986989632</longitude>
<latitude>62.47084160066127</latitude>
<altitude>0</altitude>
<heading>9.194188445440662e-10</heading>
<tilt>0</tilt>
<range>1000.000042077875</range>
<gx:altitudeMode>relativeToSeaFloor</gx:altitudeMode>
</LookAt>
<styleUrl>#msn_ylw-pushpin</styleUrl>
<Point>
<gx:drawOrder>1</gx:drawOrder>
<coordinates>-114.4435573708376,62.46869255035281,0</coordinates>
</Point>
</Placemark>
</Document>
</kml>
I am trying to set up an integration using the SDK to create KB article records in CRM 2013, and so far haven't been able to figure out a good way to build the article xml. We want to use sharepoint as our document authoring tool , and then send those documents over to CRM. From the research I've done so far, I know that in order to create a new kb article I need to link it to a template. I created a very basic template with one section as a test to work with, then in a test app using the SDK I created a new KBArticle entity instance, set the necessary required fields and assigned the template to the new article. I tried building the xml for the ArticleXML attribute by starting with the StructureXML attribute of the template and filling in the content section with some test html content. I was able to create the kb article successfully and then load it up in CRM, but it doesn't look right yet. I also created a new kb article through the UI and then using the SDK I retrieved it and examined the ArticleXML attribute to compare with the one I'm trying to create programmatically.
Here's the basic structure of the ArticleXML for an article created in the UI:
<articledata>
<section id="0">
<content>
<![CDATA[<b>Article content located here</b>]]>
</content>
</section>
<section id="1">
<content>
<![CDATA[]]>
</content>
</section>
</articledata>
Now here is the StructureXML attribute value from the template I created:
<kbarticle>
<sections nextSectionId="1">
<section type="docprop" name="title"/>
<section type="docprop" name="number"/>
<section type="edit" id="0">
<![CDATA[Content]]>
<instructions>
<![CDATA[Place KB article content here]]>
/instructions>
</section>
</sections>
<stylesheet>
<article>
<style name="background-color" value="#ffffff"/>
<style name="font-family" value="verdana"/>
<style name="font-size" value="10pt"/>
</article>
<title>
<style name="font-family" value="verdana"/>
<style name="font-size" value="16pt"/>
</title>
<number>
<style name="color" value="#666666"/>
<style name="font-size" value="9pt"/>
</number>
<heading>
<style name="font-size" value="10pt"/>
<style name="font-weight" value="bold"/>
<style name="color" value="#000066"/>
<style name="border-bottom" value="1px solid #999999"/>
</heading>
</stylesheet>
</kbarticle>
That template XML is what I tried to use and assign to the new article, but obviously it doesn't look right when the article is viewed, the template content is there along with the content I added, its basically duplicated:
I did also see there is a FormatXML attribute on the template, which contains XSL to transform the XML, I tried using this but it produces HTML output that isn't what I want either. I'm struggling with how to get from the template to the ArticleXML that I need in order to create the new KB article. Any help with this is much appreciated!
When using the example app from Ryan Bates' Railscasts Episode #362 about exporting to Excel (https://github.com/railscasts/362-exporting-csv-and-excel), I've noticed that Excel 2010 (which is on Windows) gives me a warning message when opening up the .xls file I've downloaded using the "Download as Excel" link.
The warning reads:
"The file you are trying to open ... is in a different format than specified by the file extension. Verify that the file is not corrupted and is from a trusted source before opening the file. Do you want to open the file now?"
I can open the file just fine when I click 'Yes.' And I don't even get the warning message when using Excel 2011 (on the Mac). But I'd like to be able to provide an Excel file that won't prompt that warning when a user downloads such a file from my site.
Note: I've also tried replacing all the references in the app from .xls to .xlsx, but then Excel can't open the file at all. It complains: "Excel cannot open this file. The file format or file extension is not valid. Verify that the file has not been corrupted and that the file extension matches the format of the file."
I am aware of gems such as AXLSX (https://github.com/randym/axlsx), but was hoping I could just use the Railscasts method and make a quick fix to eliminate the warning message from Excel 2010.
Thank you so much for your help!
The xls file that is generated by the Railscasts application is actually an XML file in the old Excel 2003 XML format.
Recent versions of Excel have a feature called Extension Hardening that generate this warning when the file format doesn't match the file extension:
The alert is a new security feature in Excel 2007 called Extension Hardening, which ensures that the file content being opened matches the extension type specified in the shell command that is attempting to open the file. Because the MIME types listed above are associated with the .XLS extension, the file must be in XLS (BIFF8) file format to open without this warning prompt.
In order to avoid this warning you will have to generate an Excel file in a format that matches the file extension. Editing the registry as suggested as a workaround in the above link probably isn't workable in practice. Changing the extension to xml might also work.
As alternatives writeexcel for xls, write_xlsx for xlsx and AXLSX (that you mention above) are good options.
In fact, the code generated:
<?xml version="1.0"?>
<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>
<Row>
<Cell><Data ss:Type="String">ID</Data></Cell>
<Cell><Data ss:Type="String">Name</Data></Cell>
<Cell><Data ss:Type="String">Release Date</Data></Cell>
<Cell><Data ss:Type="String">Price</Data></Cell>
</Row>
<% #products.each do |product| %>
<Row>
<Cell><Data ss:Type="Number"><%= product.id %></Data></Cell>
<Cell><Data ss:Type="String"><%= product.name %></Data></Cell>
<Cell><Data ss:Type="String"><%= product.released_on %></Data></Cell>
<Cell><Data ss:Type="Number"><%= product.price %></Data></Cell>
</Row>
<% end %>
</Table>
</Worksheet>
</Workbook>
is XML (XLS is a binary format, XLST a zipped format)
Renaming the file to .xml should work
Am trying to implement internationalization support to my project for this people suggested google Closure Templates.but am very new to closure templates.am trying to get the language specific messages using closure template but am not getting in xlf file.If any one knows how to generate language specific messages using closure template, please tell me the steps.that's great help to me.
My .soy file code as bellow.
{namespace poc}
/**
*Testing message translation
*#param pageTitle
*/
{template .translate}
<HTML>
<Head>
<title>{$pageTitle}
</title>
</head>
<div>
{msg desc="Hello"}Hello{/msg}
</div>
</html>
{/template}
and generated .xlf content as bellow
<?xml version="1.0" encoding="UTF-8"?>
<xliff version="1.2" xmlns="urn:oasis:names:tc:xliff:document:1.2">
<file original="SoyMsgBundle" datatype="x-soy-msg-bundle" xml:space="preserve" source-language="en" target-language="pt-BR">
<body>
<trans-unit id="2286494898080570401" datatype="html">
<source>Thanks</source>
<target/>
<note priority="1" from="description">Says thanks</note>
</trans-unit>
</body>
</file>
</xliff>
I see you already used the SoyMsgExtractor to create the base xlf. Next you need to make translations of this base xlf to the languages you want to support. A file for each language is created. I used the xliff exitor from Translution. http://sourceforge.net/projects/eviltrans.
Next, using the SoyToJsSrcCompiler a translation soy can be made per language:
java -jar SoyToJsSrcCompiler.jar --shouldGenerateGoogMsgDefs --bidiGlobalDir 1 --messageFilePathFormat Filename_en-us.xliff --outputPathFormat FileName_fr.js *.soy
This will create a Filename._fr.js file that contains the compiled soy file.
Including this file instead of the original soy (or compiled) will create a localized version.
Good luck!
\Rene
i think the easiest way is to make (i.e. generate from whatever source) a separate js file which contains one messages object and reference it through an extern declared function.
it justs works and has no complicated dependencies.
I have an ASP.Net MVC site that generates a Microsoft Excel 2003 XML formatted spreadsheet. The spreadsheet looks good, the controller and views both work, but the file won't open in Excel. It opens in the browser because it is an XML document.
I tried changing the ContentType to be the Excel XLS format (application/excel) and that made Excel open the file but it gives a warning message that the file is an XML document, not an XLS document.
How do you make an Excel XML document open in Excel from a web site?
<%# Page Language="C#" Inherits="System.Web.Mvc.ViewPage" %><%
this.Context.Response.Clear();
this.Context.Response.AddHeader("content-disposition", "attachment;filename=State_Report_" + this.ViewData["State"] + ".xml");
this.Context.Response.Charset = "";
this.Context.Response.Cache.SetCacheability(HttpCacheability.NoCache);
this.Context.Response.ContentType = "application/excel";
%><?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">
Try with
Response.ContentType = "application/vnd.ms-excel"
And keep the .XML extension.
Your problem may be in using the file extension .xml, which you're adding in your header.
My code that does this same thing does not have a file extension at all.
You might try dropping that .xml extension, or changing it to .xls or .csv.