Exporting to and XML in Spread.net

Posted by: cassius on 8 September 2017, 2:22 pm EST

  • Posted 8 September 2017, 2:22 pm EST

    I need some help. Can someone help me with the code to export sheets individually to XML.
    I was able to do it successfully in vb 6 but once I moved to .net I am having some trouble.

    In Vb6 I used:

    fpSpread1.Sheet = 1

        ret = fpSpread1.ExportRangeToXML(1, 2, 2, 10, "C:\test\data\General Assumptions.xml", "root_element", "collection_element", ExportToXMLFormattedData, "")

       How can I convert this code in .net? Please help

    Vida 

  • Replied 8 September 2017, 2:22 pm EST

    Hello Vida,


    There is no equivalent of ExportRangeToXML in .Net. However, to save the range of Cells in XML you can get it work by saving the cell range in another hidden spread and then save that spreadsheet in XML. Here is the code to achieve the same :


    <BLOCKQUOTE>

            private void SaveRangeInXML_Click(object sender, EventArgs e)
            {
                FarPoint.Win.Spread.Model.CellRange cr;
                string s;
                int selections, j;
                selections = fpSpread1.ActiveSheet.SelectionCount;
                for (j = 0; j < selections; j++)
                {
                    cr = new FarPoint.Win.Spread.Model.CellRange(1, 2, 2, 10);
                    s = fpSpread1.ActiveSheet.GetClip(cr.Row, cr.Column, cr.RowCount, cr.ColumnCount);
                    fpSpread2.Sheets[0].SetClip(cr.Row, cr.Column, cr.RowCount, cr.ColumnCount, s);
                }
                fpSpread2.Sheets[0].SaveXml("d:\\XML.xml");
            }

    </BLOCKQUOTE>

    Hope it will hekp you. Thanks.

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels