找回密码
 立即注册

QQ登录

只需一步,快速开始

yaoxiaoqiang00
中级会员   /  发表于:2015-4-16 16:58  /   查看:6801  /  回复:4
?<?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();
                }

4 个回复

倒序浏览
iceman
社区贡献组   /  发表于:2015-4-17 09:22:00
沙发
回复 1楼yaoxiaoqiang00的帖子

问题正在处理中,稍后反馈。
回复 使用道具 举报
iceman
社区贡献组   /  发表于:2015-4-17 10:46:00
板凳
回复 2楼iceman的帖子

通过附近 Demo 没有重现描述的问题。重现步骤:
1.运行附近Demo
2.点击 LoadFile 按钮,加载1#XML文件。
3.点击SaveFile按钮。

示例:
16640.zip (2.68 MB, 下载次数: 422)
回复 使用道具 举报
yaoxiaoqiang00
中级会员   /  发表于:2015-4-17 11:20:00
地板
回复 3楼iceman的帖子

Thank you very much!我已经找到问题了,因为我给Row.Tag属性赋了引用类型的值,如果两行都绑定了同一个引用类型的对象,就会报这个错
回复 使用道具 举报
iceman
社区贡献组   /  发表于:2015-4-17 12:14:00
5#
回复 4楼yaoxiaoqiang00的帖子

客气了,感谢你反馈问题处理结果。本问题关闭了。

为了给你提供更优质的服务,请对本次服务进行评分。我们会认真对待你提出的宝贵意见,谢谢        
回复 使用道具 举报
您需要登录后才可以回帖 登录 | 立即注册
返回顶部