?<?xml version="1.0" encoding="utf-8"?><Spread><View><SpreadUI><TabStripVisibility value="Collapsed" /></SpreadUI></View><Data><Workbook version="8.40.20143.0" theme="Office"><ActiveSheetIndex value="0" /><StartSheetIndex value="0"
/><Sheets count="1"><Sheet index="0" name="Sheet1"><Formula><Item r="11" c="12" formula="SUM(M11)" /><Item r="3" c="12" formula="SUM(M3)" /></Formula><DefaultColumnHeaderStyle><HorizontalAlignment value="Center" /><VerticalAlignment
value="Center" /></DefaultColumnHeaderStyle><DefaultRowHeaderStyle><HorizontalAlignment value="Center" /><VerticalAlignment value="Center" /></DefaultRowHeaderStyle><CellBlock rc="496" cc="98"><Data><C pos="3,11" type="0" value="合计:"
/><C pos="3,12" type="1" value="0" /><C pos="11,11" type="0" value="合计:" /><C pos="11,12" type="1" value="0" /><Types><Type id="0" name="System.String" assembly="mscorlib" /><Type id="1" name="System.Double" assembly="mscorlib"
/></Types></Data><Style><C pos="0,0" type="0"><LeftBorder><Type value="Dashed" /><Color value="#FF000000" /></LeftBorder><TopBorder><Type value="Dashed" /><Color value="#FF000000" /></TopBorder><Formatter value="[Auto]General" /></C><C
pos="0,1" type="0"><TopBorder><Type value="Dashed" /><Color value="#FF000000" /></TopBorder></C><C pos="0,2" type="0"><TopBorder><Type value="Dashed" /><Color value="#FF000000" /></TopBorder></C><C pos="0,3" type="0"><TopBorder><Type
value="Dashed" /><Color value="#FF000000" /></TopBorder></C><C pos="0,4" type="0"><TopBorder><Type value="Dashed" /><Color value="#FF000000" /></TopBorder></C><C pos="0,5" type="0"><TopBorder><Type value="Dashed" /><Color
value="#FF000000" /></TopBorder></C><C pos="0,6" type="0"><TopBorder><Type value="Dashed" /><Color value="#FF000000" /></TopBorder></C><C pos="0,7" type="0"><TopBorder><Type value="Dashed" /><Color value="#FF000000" /></TopBorder></C><C
pos="0,8" type="0"><TopBorder><Type value="Dashed" /><Color value="#FF000000" /></TopBorder></C><C pos="0,9" type="0"><TopBorder><Type value="Dashed" /><Color value="#FF000000" /></TopBorder></C><C pos="0,10" type="0"><TopBorder><Type
value="Dashed" /><Color value="#FF000000" /></TopBorder></C><C pos="0,11" type="0"><TopBorder><Type value="Dashed" /><Color value="#FF000000" /></TopBorder></C><C pos="0,12" type="0"><TopBorder><Type value="Dashed" /><Color
value="#FF000000" /></TopBorder><RightBorder><Type value="Dashed" /><Color value="#FF000000" /></RightBorder></C><C pos="0,13" type="0"><LeftBorder value="(null)" /></C><C pos="1,0" type="0"><LeftBorder><Type value="Dashed" /><Color
value="#FF000000" /></LeftBorder></C><C pos="1,12" type="0"><RightBorder><Type value="Dashed" /><Color value="#FF000000" /></RightBorder></C><C pos="1,13" type="0"><LeftBorder value="(null)" /></C><C pos="2,0" type="0"><LeftBorder><Type
value="Dashed" /><Color value="#FF000000" /></LeftBorder><BottomBorder><Type value="Dashed" /><Color value="#FF000000" /></BottomBorder></C><C pos="2,1" type="0"><BottomBorder><Type value="Dashed" /><Color value="#FF000000"
/></BottomBorder></C><C pos="2,2" type="0"><BottomBorder><Type value="Dashed" /><Color value="#FF000000" /></BottomBorder></C><C pos="2,3" type="0"><BottomBorder><Type value="Dashed" /><Color value="#FF000000" /></BottomBorder></C><C
pos="2,4" type="0"><BottomBorder><Type value="Dashed" /><Color value="#FF000000" /></BottomBorder></C><C pos="2,5" type="0"><BottomBorder><Type value="Dashed" /><Color value="#FF000000" /></BottomBorder></C><C pos="2,6"
type="0"><BottomBorder><Type value="Dashed" /><Color value="#FF000000" /></BottomBorder></C><C pos="2,7" type="0"><BottomBorder><Type value="Dashed" /><Color value="#FF000000" /></BottomBorder></C><C pos="2,8"
type="0"><BottomBorder><Type value="Dashed" /><Color value="#FF000000" /></BottomBorder></C><C pos="2,9" type="0"><BottomBorder><Type value="Dashed" /><Color value="#FF000000" /></BottomBorder></C><C pos="2,10"
type="0"><BottomBorder><Type value="Dashed" /><Color value="#FF000000" /></BottomBorder></C><C pos="2,11" type="0"><BottomBorder><Type value="Dashed" /><Color value="#FF000000" /></BottomBorder></C><C pos="2,12"
type="0"><RightBorder><Type value="Dashed" /><Color value="#FF000000" /></RightBorder><BottomBorder><Type value="Dashed" /><Color value="#FF000000" /></BottomBorder><Formatter value="[Auto]General" /></C><C pos="2,13"
type="0"><LeftBorder value="(null)" /></C><C pos="3,0" type="0"><TopBorder value="(null)" /></C><C pos="3,1" type="0"><TopBorder value="(null)" /></C><C pos="3,2" type="0"><TopBorder value="(null)" /></C><C pos="3,3" type="0"><TopBorder
value="(null)" /></C><C pos="3,4" type="0"><TopBorder value="(null)" /></C><C pos="3,5" type="0"><TopBorder value="(null)" /></C><C pos="3,6" type="0"><TopBorder value="(null)" /></C><C pos="3,7" type="0"><TopBorder value="(null)"
/></C><C pos="3,8" type="0"><TopBorder value="(null)" /></C><C pos="3,9" type="0"><TopBorder value="(null)" /></C><C pos="3,10" type="0"><TopBorder value="(null)" /></C><C pos="3,11" type="0"><TopBorder value="(null)" /><Formatter
value="[Auto]General" /></C><C pos="3,12" type="0"><TopBorder value="(null)" /></C><C pos="7,0" type="0"><BottomBorder value="(null)" /></C><C pos="7,1" type="0"><BottomBorder value="(null)" /></C><C pos="7,2" type="0"><BottomBorder
value="(null)" /></C><C pos="7,3" type="0"><BottomBorder value="(null)" /></C><C pos="7,4" type="0"><BottomBorder value="(null)" /></C><C pos="7,5" type="0"><BottomBorder value="(null)" /></C><C pos="7,6" type="0"><BottomBorder
value="(null)" /></C><C pos="7,7" type="0"><BottomBorder value="(null)" /></C><C pos="7,8" type="0"><BottomBorder value="(null)" /></C><C pos="7,9" type="0"><BottomBorder value="(null)" /></C><C pos="7,10" type="0"><BottomBorder
value="(null)" /></C><C pos="7,11" type="0"><BottomBorder value="(null)" /></C><C pos="7,12" type="0"><BottomBorder value="(null)" /></C><C pos="8,0" type="0"><LeftBorder><Type value="Dashed" /><Color value="#FF000000"
/></LeftBorder><TopBorder><Type value="Dashed" /><Color value="#FF000000" /></TopBorder></C><C pos="8,1" type="0"><TopBorder><Type value="Dashed" /><Color value="#FF000000" /></TopBorder></C><C pos="8,2" type="0"><TopBorder><Type
value="Dashed" /><Color value="#FF000000" /></TopBorder></C><C pos="8,3" type="0"><TopBorder><Type value="Dashed" /><Color value="#FF000000" /></TopBorder></C><C pos="8,4" type="0"><TopBorder><Type value="Dashed" /><Color
value="#FF000000" /></TopBorder></C><C pos="8,5" type="0"><TopBorder><Type value="Dashed" /><Color value="#FF000000" /></TopBorder></C><C pos="8,6" type="0"><TopBorder><Type value="Dashed" /><Color value="#FF000000" /></TopBorder></C><C
pos="8,7" type="0"><TopBorder><Type value="Dashed" /><Color value="#FF000000" /></TopBorder></C><C pos="8,8" type="0"><TopBorder><Type value="Dashed" /><Color value="#FF000000" /></TopBorder></C><C pos="8,9" type="0"><TopBorder><Type
value="Dashed" /><Color value="#FF000000" /></TopBorder></C><C pos="8,10" type="0"><TopBorder><Type value="Dashed" /><Color value="#FF000000" /></TopBorder></C><C pos="8,11" type="0"><TopBorder><Type value="Dashed" /><Color
value="#FF000000" /></TopBorder></C><C pos="8,12" type="0"><TopBorder><Type value="Dashed" /><Color value="#FF000000" /></TopBorder><RightBorder><Type value="Dashed" /><Color value="#FF000000" /></RightBorder></C><C pos="8,13"
type="0"><LeftBorder value="(null)" /></C><C pos="9,0" type="0"><LeftBorder><Type value="Dashed" /><Color value="#FF000000" /></LeftBorder></C><C pos="9,12" type="0"><RightBorder><Type value="Dashed" /><Color value="#FF000000"
/></RightBorder></C><C pos="9,13" type="0"><LeftBorder value="(null)" /></C><C pos="10,0" type="0"><LeftBorder><Type value="Dashed" /><Color value="#FF000000" /></LeftBorder><BottomBorder><Type value="Dashed" /><Color value="#FF000000"
/></BottomBorder></C><C pos="10,1" type="0"><BottomBorder><Type value="Dashed" /><Color value="#FF000000" /></BottomBorder></C><C pos="10,2" type="0"><BottomBorder><Type value="Dashed" /><Color value="#FF000000" /></BottomBorder></C><C
pos="10,3" type="0"><BottomBorder><Type value="Dashed" /><Color value="#FF000000" /></BottomBorder></C><C pos="10,4" type="0"><BottomBorder><Type value="Dashed" /><Color value="#FF000000" /></BottomBorder></C><C pos="10,5"
type="0"><BottomBorder><Type value="Dashed" /><Color value="#FF000000" /></BottomBorder></C><C pos="10,6" type="0"><BottomBorder><Type value="Dashed" /><Color value="#FF000000" /></BottomBorder></C><C pos="10,7"
type="0"><BottomBorder><Type value="Dashed" /><Color value="#FF000000" /></BottomBorder></C><C pos="10,8" type="0"><BottomBorder><Type value="Dashed" /><Color value="#FF000000" /></BottomBorder></C><C pos="10,9"
type="0"><BottomBorder><Type value="Dashed" /><Color value="#FF000000" /></BottomBorder></C><C pos="10,10" type="0"><BottomBorder><Type value="Dashed" /><Color value="#FF000000" /></BottomBorder></C><C pos="10,11"
type="0"><BottomBorder><Type value="Dashed" /><Color value="#FF000000" /></BottomBorder></C><C pos="10,12" type="0"><RightBorder><Type value="Dashed" /><Color value="#FF000000" /></RightBorder><BottomBorder><Type value="Dashed" /><Color
value="#FF000000" /></BottomBorder><Formatter value="[Auto]General" /></C><C pos="10,13" type="0"><LeftBorder value="(null)" /></C><C pos="11,0" type="0"><TopBorder value="(null)" /></C><C pos="11,1" type="0"><TopBorder value="(null)"
/></C><C pos="11,2" type="0"><TopBorder value="(null)" /></C><C pos="11,3" type="0"><TopBorder value="(null)" /></C><C pos="11,4" type="0"><TopBorder value="(null)" /></C><C pos="11,5" type="0"><TopBorder value="(null)" /></C><C
pos="11,6" type="0"><TopBorder value="(null)" /></C><C pos="11,7" type="0"><TopBorder value="(null)" /></C><C pos="11,8" type="0"><TopBorder value="(null)" /></C><C pos="11,9" type="0"><TopBorder value="(null)" /></C><C pos="11,10"
type="0"><TopBorder value="(null)" /></C><C pos="11,11" type="0"><TopBorder value="(null)" /><Formatter value="[Auto]General" /></C><C pos="11,12" type="0"><TopBorder value="(null)" /></C><Types><Type id="0"
name="GrapeCity.Windows.SpreadSheet.Data.StyleInfo" /></Types></Style></CellBlock><RowHeaderBlock rc="496" cc="1" /><ColumnHeaderBlock rc="1" cc="98" /><ViewportRowsAxis length="496" /><ViewportColumnsAxis length="98"
/><RowHeaderColumnsAxis length="1" /><ColumnHeaderRowsAxis length="1" /><ViewportRowsAxisStyle length="496" /><ViewportColumnsAxisStyle length="98" /><RowHeaderRowsAxisStyle length="496" /><RowHeaderColumnsAxisStyle length="1"
/><ColumnHeaderRowsAxisStyle length="1" /><ColumnHeaderColumnsAxisStyle length="98" /><SelectionModel><SelectionPolicy value="Range" /><Items><Item r="8" c="0" rc="1" cc="1" /></Items><AnchorCellRow value="8"
/></SelectionModel><ViewportInfo rowPaneCount="1" columnPaneCount="1"><ViewportLeftColumns><Item type="System.Int32" value="0" /></ViewportLeftColumns><ViewportTopRows><Item type="System.Int32" value="0"
/></ViewportTopRows><ViewportWidths><Item type="System.Double" value="-1" /></ViewportWidths><ViewportHeights><Item type="System.Double" value="-1" /></ViewportHeights></ViewportInfo></Sheet></Sheets></Workbook></Data></Spread>
第一步: 通过上边样式字符串打开gcSpreadSheet
using (MemoryStream memoryStream = new MemoryStream(Encoding.UTF8.GetBytes(传入上边字符串)))
{
gcSpreadSheet.OpenXml(memoryStream);
memoryStream.Close();
}
第二步: 从gcSpreadSheet上获取样式字符串
using (MemoryStream memoryStream = new MemoryStream())
{
// 这个地方报错:“type”是重复的属性名称
gcSpreadSheet.SaveXml(memoryStream, false);
memoryStream.Position = 0;
int leng = memoryStream.Length < Int32.MaxValue ? (int)memoryStream.Length : 0;
byte[] by = new byte[leng];
memoryStream.Read(by, 0, leng);
xmlData = Encoding.UTF8.GetString(by, 0, by.Length);
memoryStream.Close();
} |
|