Currently have an issue with Excel 2007 which is currently deployed across our Corporate environment - conflicts with other software prevent the upgrade to a new version of MS Office. I have been able to verify that the same issue persists when using Excel 2010, after making the spreadsheet editable. Additionally, long URLs appear to be supported when they are created within the spreadsheet, just not supported via import/opening an XML formatted file with cells that are configured with the long URL.
Issue:
When loading an XML formatted file, "String too long" messages are generated for the URL/Hyperlink fields which exceed 256 characters in length. The size of the URLs actually ranges from 700-800 characters long which are tied to a resume & personnel system and the URLs CANNOT be shortened. Only when the cell is formatted for a hyperlink does the "string too long" message appear; if the cell is created with passing the entire string, all of the text is placed within the cell and no error log is generated when the file is opened.
Example of Long URL:
Trimmed to: C# 4.0 Code for XML header file: writer.WriteLine( "<?xml version=\"1.0\" encoding=\"utf-8\"?>"); writer.WriteLine( |
"<?mso-application progid=\"Excel.Sheet\"?>");
writer.WriteLine(
"<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\">");
writer.WriteLine(
"<DocumentProperties xmlns=\"urn:schemas-microsoft-com:office:office\">");
writer.WriteLine(
"<Author>James Putnam</Author>");
writer.WriteLine(
"<LastAuthor>jwputnam</LastAuthor>");
writer.WriteLine(
"<Created>2013-03-12T16:54:15Z</Created>");
writer.WriteLine(
"<LastSaved>2013-03-20T05:18:54Z</LastSaved>");
writer.WriteLine(
"<Company>ManTech International - MCIS</Company>");
writer.WriteLine(
"<Version>12.00</Version>");
writer.WriteLine(
"</DocumentProperties>");
writer.WriteLine(
"<OfficeDocumentSettings xmlns=\"urn:schemas-microsoft-com:office:office\">");
writer.WriteLine(
"<DownloadComponents/>");
writer.WriteLine(
"<LocationOfComponents HRef=\"file:///D:\"/>");
writer.WriteLine(
"</OfficeDocumentSettings>");
writer.WriteLine(
"<ExcelWorkbook xmlns=\"urn:schemas-microsoft-com:office:excel\">");
writer.WriteLine(
"<WindowHeight>8700</WindowHeight>");
writer.WriteLine(
"<WindowWidth>11355</WindowWidth>");
writer.WriteLine(
"<WindowTopX>480</WindowTopX>");
writer.WriteLine(
"<WindowTopY>120</WindowTopY>");
writer.WriteLine(
"<ProtectStructure>False</ProtectStructure>");
writer.WriteLine(
"<ProtectWindows>False</ProtectWindows>");
writer.WriteLine(
"</ExcelWorkbook>");
writer.WriteLine(
"<Styles>");
writer.WriteLine(
"<Style ss:ID=\"Default\" ss:Name=\"Normal\">");
writer.WriteLine(
"<Alignment ss:Vertical=\"Bottom\"/>");
writer.WriteLine(
"<Borders/>");
writer.WriteLine(
"<Font/>");
writer.WriteLine(
"<Interior/>");
writer.WriteLine(
"<NumberFormat/>");
writer.WriteLine(
"<Protection/>");
writer.WriteLine(
"</Style>");
writer.WriteLine(
"<Style ss:ID=\"s62\" ss:Name=\"Hyperlink\">");
writer.WriteLine(
"<Font ss:FontName=\"Arial\" x:Family=\"Swiss\" ss:Color=\"#0000FF\" ss:Underline=\"Single\"/>");
writer.WriteLine(
"</Style>");
writer.WriteLine(
"<Style ss:ID=\"s63\">");
writer.WriteLine(
"<Font ss:FontName=\"Arial\" x:Family=\"Swiss\" ss:Size=\"8\"/>");
writer.WriteLine(
"</Style>");
writer.WriteLine(
"<Style ss:ID=\"s65\" ss:Parent=\"s62\">");
writer.WriteLine(
"<Alignment ss:Vertical=\"Bottom\"/>");
writer.WriteLine(
"<Font ss:FontName=\"Arial\" x:Family=\"Swiss\" ss:Size=\"8\" ss:Color=\"#0000FF\" ss:Underline=\"Single\"/>");
writer.WriteLine(
"<Protection/>");
writer.WriteLine(
"</Style>");
writer.WriteLine(
"<Style ss:ID=\"s70\">");
writer.WriteLine(
"<Font ss:FontName=\"Arial\" x:Family=\"Swiss\" ss:Color=\"#FFFFFF\"/>");
writer.WriteLine(
"</Style>");
writer.WriteLine(
"<Style ss:ID=\"s73\">");
writer.WriteLine(
"<Borders>");
writer.WriteLine(
"<Border ss:Position=\"Bottom\" ss:LineStyle=\"Continuous\" ss:Weight=\"1\" ss:Color=\"#FFFFFF\"/>");
writer.WriteLine(
"<Border ss:Position=\"Left\" ss:LineStyle=\"Continuous\" ss:Weight=\"1\" ss:Color=\"#FFFFFF\"/>");
writer.WriteLine(
"<Border ss:Position=\"Right\" ss:LineStyle=\"Continuous\" ss:Weight=\"1\" ss:Color=\"#FFFFFF\"/>");
writer.WriteLine(
"<Border ss:Position=\"Top\" ss:LineStyle=\"Continuous\" ss:Weight=\"1\" ss:Color=\"#FFFFFF\"/>");
writer.WriteLine(
"</Borders>");
writer.WriteLine(
"<Font ss:FontName=\"Arial\" x:Family=\"Swiss\" ss:Size=\"8\" ss:Color=\"#FFFFFF\"/>");
writer.WriteLine(
"<Interior ss:Color=\"#4A606E\" ss:Pattern=\"Solid\"/>");
writer.WriteLine(
"</Style>");
writer.WriteLine(
"</Styles>");
Code to generate Hyperlink line:
writer.WriteLine(
"<Cell ss:StyleID=\"s65\" ss:HRef=\""+ sDataString +"\"><Data ss:Type=\"String\" >URL/Link</Data></Cell>");
(1) Is this problem resolved with another version of Office/Excel?
(2) is there a workaround to have long URLs be accepted by Excel? (Web research has not yielded successful answers/results.)