Sign UpSign Up   Sign InSign In Welcome Guest,
Live Chat Live Chat

Problem with smart markers group:merge when a custom object list is processed.

Last post 08-30-2009, 2:04 AM by aspose.notifier. 4 replies.
Sort Posts: Previous Next
  •  04-27-2009, 7:47 AM 176809

    Problem with smart markers group:merge when a custom object list is processed.

    Hi,

    I facing a crash while using smart markers group:merge functionality while using custom object list in Aspose.Cells. I am using the Aspose dll with version 4.7.0.0

    Problem Faced:
    System.NullReferenceException: Object reference not set to an instance of an object.
       at Aspose.Cells.WorkbookDesigner.⾶(Cells ᒹ, Int32 ሶ, ArrayList ⾷)
       at Aspose.Cells.WorkbookDesigner.⾸(Int32 ሁ, Boolean ⾵)
       at Aspose.Cells.WorkbookDesigner.Process(Int32 sheetIndex, Boolean isPreserved)
       at WindowsFormsApplication1.Form1.CreateDesignerAndSetData() in F:\Manu\Projects\HCAF\Aspose\CalculateSum\WindowsFormsApplication1\WindowsFormsApplication1\Form1.cs:line 306

    Call Stack:
    >    Aspose.Cells.dll!Aspose.Cells.WorkbookDesigner.?(Aspose.Cells.Cells ? = {Aspose.Cells.Cells}, int ? = 1, System.Collections.ArrayList ? = Count = 2) + 0xff3 bytes    
         Aspose.Cells.dll!Aspose.Cells.WorkbookDesigner.?(int ? = 0, bool ? = false) + 0x214 bytes    
         Aspose.Cells.dll!Aspose.Cells.WorkbookDesigner.Process(bool isPreserved = false) + 0x89 bytes    
         Aspose.Cells.dll!Aspose.Cells.WorkbookDesigner.Process() + 0x20 bytes    
         WindowsFormsApplication1.exe!WindowsFormsApplication1.Form1.CreateDesignerAndSetData() Line 78 + 0xb bytes    C#
         WindowsFormsApplication1.exe!WindowsFormsApplication1.Form1.Form1_Load(object sender = {WindowsFormsApplication1.Form1, Text: Form1}, System.EventArgs e = {System.EventArgs}) Line 140 + 0x8 bytes    C#

    Code:
        struct Person
        {
            private String _name;
            private Int32 _age;

            public String Name
            {
                get { return _name; }
                set { _name = value; }
            }

            public Int32 Age
            {
                get { return _age; }
                set { _age = value; }
            }
        }

            public void CreateDesignerAndSetData()
            {
                String xlFileName = @"F:\Manu\WindowsFormsApplication1\Files\MyNewXLFile.xls";
                WorkbookDesigner myWorkbook = new WorkbookDesigner();
                myWorkbook.Open(xlFileName);
                Worksheet curentWorksheet = myWorkbook.Workbook.Worksheets["Sheet1"];

                // Create temporary data
                IList<Person> myList = new List<Person>();
                myList.Add(new Person() { Name = "X",    Age = 26 });
                myList.Add(new Person() { Name = "X",    Age = 32 });
                myList.Add(new Person() { Name = "Y",    Age = 19 });

                
                // Set the headers and smart markers to the XL file
                curentWorksheet.Cells["A1"].PutValue("Name");
                curentWorksheet.Cells["B1"].PutValue("Age");
                curentWorksheet.Cells["A2"].PutValue("&=Person.Name(group:merge,skip:1)");
                curentWorksheet.Cells["B2"].PutValue("&=Person.Age");

                // Set the data to the XL sheet
                myWorkbook.SetDataSource("Person", myList);

                myWorkbook.Process();
                myWorkbook.Workbook.Save("c:\\Manu_Test.xls");

                Process.Start("c:\\Manu_Test.xls");
            }



    The code crashes @ the line 'myWorkbook.Process();'. If we replace 'curentWorksheet.Cells["A2"].PutValue("&=Person.Name(group:merge,skip:1)");' with 'curentWorksheet.Cells["A1"].PutValue("&=Person.Name");', the code works with out any merging/grouping. The crash surfaces as soon as we add any group method to the smart marker.


    This error only happens in case of a custom object. If the data is read from a database and the dataset is send in to be processed everything works fine. i.e. the merging works.


    Please help.




    This message was posted using Page2Forum from Smart Markers - Aspose.Cells for .NET and Java
     
  •  04-27-2009, 8:29 AM 176815 in reply to 176809

    Re: Problem with smart markers group:merge when a custom object list is processed.

    Hi,

    Thanks for sharing details with sample code.

    Well, we found the issue, Aspose.Cells for .NET smart marker's grouping data feature does not work with Custom Objects/Types. We will look into it if we can enhance it for your requirement.

    Thank you.

     


    Amjad Sahi
    Support Developer,
    Aspose Sialkot Team
    Contact Us
     
  •  04-28-2009, 7:42 AM 177025 in reply to 176815

    Re: Problem with smart markers group:merge when a custom object list is processed.

    Attachment: Present (inaccessible)

    Hi,

    Please try the attached version, we have supported to group the custom object list in the smart markers.

    Thank you.


    Amjad Sahi
    Support Developer,
    Aspose Sialkot Team
    Contact Us
     
  •  04-29-2009, 9:34 AM 177284 in reply to 177025

    Re: Problem with smart markers group:merge when a custom object list is processed.

    Hi Amjad,

    Thanks for the immediate response. The attached DLL is working fine. It is grouping the custom objects also. Well done :)

    Thanks
    Manu
     
  •  08-30-2009, 2:04 AM 195696 in reply to 176809

    Re: Problem with smart markers group:merge when a custom object list is processed.

    The issues you have found earlier (filed as 8668) have been fixed in this update.


    This message was posted using Notification2Forum from Downloads module by aspose.notifier.

    Note: Just for your knowledge. In the new release v4.8.0, we have merged Aspose.Grid suite to Aspose.Cells for .NET msi installer as Aspose.Grid would be no longer offered as a separate product now. You need to install the installer (uninstall older one first if you have) and use only Aspose.Cells.dll library in your project for your need. You may also take advantage using Aspose.Cells Grid suite though.

     
View as RSS news feed in XML