![]() |
AutoFitHeight and Height not working together
In Microsoft's Spreadsheet XML documentation
(http://msdn.microsoft.com/library/de...odc_xmlss.asp), I see the following under the <ss:Row tag: If ss:AutoFitHeight="1" and ss:Height is specified: Set the row to the specified height and only autofit if the size of the content is larger than the specified height However, when I generate XML using both of these attributes (ss:AutoFitHeight and ss:Height) on <Row, and then try to open the XML file in Excel, it is not doing the AutoFitHeight. I need to use both attributes, because my users want the row height to be 18.75 (this number is in points) unless text in the row needs to be wrapped, then they want the row to auto fit. I have tried using the above attributes in various combinations with DefaultRowHeight in the <Table tag, nothing worked. I also tried going into Excel performing the actions and then saving the file as XML to see how Excel is writing out the information in XML. They are not writing out the AutoFitHeight tag, they are adjusting the value of ss:Height and writing that out. I was trying to avoid having to come up with some formula myself for knowing when to adjust my ss:Height manually as Excel seems to be doing. That would be quite difficult since my users want to use Times New Roman font - where all letters do not have the same width. Has anyone else experienced this or have any ideas? Any help would be greatly appreciated. Thanks! Here is a sample test XML file that I am using: <?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" <DocumentProperties xmlns="urn:schemas-microsoft-com:office:office" <Authorme</Author <LastAuthorme</LastAuthor <Created2005-09-30T19:30:49Z</Created <Companymycompany</Company <Version10.4219</Version </DocumentProperties <OfficeDocumentSettings xmlns="urn:schemas-microsoft-com:office:office" <DownloadComponents/ <LocationOfComponents HRef="file:///D:\"/ </OfficeDocumentSettings <ExcelWorkbook xmlns="urn:schemas-microsoft-com:office:excel" <WindowHeight8955</WindowHeight <WindowWidth14235</WindowWidth <WindowTopX480</WindowTopX <WindowTopY90</WindowTopY <ProtectStructureFalse</ProtectStructure <ProtectWindowsFalse</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" x:Family="Roman" ss:Size="12"/ </Style <Style ss:ID="s22" <Alignment ss:Vertical="Bottom" ss:WrapText="1"/ <Font ss:FontName="Times New Roman" x:Family="Roman" ss:Size="12"/ </Style </Styles <Worksheet ss:Name="Sheet1" <Table ss:ExpandedColumnCount="1" ss:ExpandedRowCount="7" x:FullColumns="1" x:FullRows="1" ss:StyleID="s21" <Column ss:StyleID="s22" ss:AutoFitWidth="0" ss:Width="95.25"/ <Row ss:AutoFitHeight="1" ss:Height="18.75" <Cell<Data ss:Type="String"Long name before autofit - row 1</Data</Cell </Row <Row ss:AutoFitHeight="1" ss:Height="18.75" <Cell<Data ss:Type="String"row 2</Data</Cell </Row <Row ss:AutoFitHeight="1" ss:Height="18.75" <Cell<Data ss:Type="String"Long name after autofit - row 3</Data</Cell </Row <Row ss:AutoFitHeight="1" ss:Height="18.75"/ <Row ss:AutoFitHeight="1" ss:Height="18.75" <Cell<Data ss:Type="String"Long name after autofit but no enter when done - row 5</Data</Cell </Row <Row ss:AutoFitHeight="1" ss:Height="18.75"/ <Row ss:AutoFitHeight="1" ss:Height="18.75" <Cell<Data ss:Type="String"Long name before autofit but autofit when done - row 7</Data</Cell </Row </Table <WorksheetOptions xmlns="urn:schemas-microsoft-com:office:excel" <Unsynced/ <ValidPrinterInfo/ <HorizontalResolution600</HorizontalResolution <VerticalResolution600</VerticalResolution <Selected/ <ProtectObjectsFalse</ProtectObjects <ProtectScenariosFalse</ProtectScenarios </WorksheetOptions </Worksheet <Worksheet ss:Name="Sheet2" <WorksheetOptions xmlns="urn:schemas-microsoft-com:office:excel" <ProtectObjectsFalse</ProtectObjects <ProtectScenariosFalse</ProtectScenarios </WorksheetOptions </Worksheet <Worksheet ss:Name="Sheet3" <WorksheetOptions xmlns="urn:schemas-microsoft-com:office:excel" <ProtectObjectsFalse</ProtectObjects <ProtectScenariosFalse</ProtectScenarios </WorksheetOptions </Worksheet </Workbook |
All times are GMT +1. The time now is 11:06 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com