Hello,
I saw in the release notes for version 7.2.1 that smartmarkers now supports nested objects but I can find no documentation or other reference to this topic on your site.
Can you tell me how the nested objects work?
Thank you!
Hello,
I saw in the release notes for version 7.2.1 that smartmarkers now supports nested objects but I can find no documentation or other reference to this topic on your site.
Can you tell me how the nested objects work?
Thank you!
Hi,
Hi,
class Individual
{//Initialize WorkbookDesigner object WorkbookDesigner designer = new WorkbookDesigner(); //Load the template file designer.Workbook = new Workbook("e:\\test2\\SM_NestedObjects.xlsx"); //Instantiate the List based on the class System.Collections.Generic.ICollection list = new System.Collections.Generic.List(); //Create an object for the Individual class Individual p1 = new Individual("Damian", 30); //Create the relevant Wife class for the Individual p1.Wife = new Wife("Dalya", 28); //Create another object for the Individual class Individual p2 = new Individual("Mack", 31); //Create the relevant Wife class for the Individual p2.Wife = new Wife("Maaria", 29); //Add the objects to the list list.Add(p1); list.Add(p2); //Specify the DataSource designer.SetDataSource("Individual", list); //Process the markers designer.Process(false); //Save the Excel file. designer.Workbook.Save("e:\\test2\\out_SM_NestedObjects.xlsx");<span class="code-keyword" style="color: rgb(0, 0, 145); background-color: inherit; ">private</span> <span class="code-object" style="color: rgb(145, 0, 145); background-color: inherit; ">String</span> m_Name; <span class="code-keyword" style="color: rgb(0, 0, 145); background-color: inherit; ">public</span> <span class="code-object" style="color: rgb(145, 0, 145); background-color: inherit; ">String</span> Name { get { <span class="code-keyword" style="color: rgb(0, 0, 145); background-color: inherit; ">return</span> m_Name; } set { m_Name = value; } } <span class="code-keyword" style="color: rgb(0, 0, 145); background-color: inherit; ">private</span> <span class="code-object" style="color: rgb(145, 0, 145); background-color: inherit; ">int</span> m_Age; <span class="code-keyword" style="color: rgb(0, 0, 145); background-color: inherit; ">public</span> <span class="code-object" style="color: rgb(145, 0, 145); background-color: inherit; ">int</span> Age { get { <span class="code-keyword" style="color: rgb(0, 0, 145); background-color: inherit; ">return</span> m_Age; } set { m_Age = value; } } internal Individual(string name, <span class="code-object" style="color: rgb(145, 0, 145); background-color: inherit; ">int</span> age) { <span class="code-keyword" style="color: rgb(0, 0, 145); background-color: inherit; ">this</span>.Name = name; <span class="code-keyword" style="color: rgb(0, 0, 145); background-color: inherit; ">this</span>.Age = age; } <span class="code-keyword" style="color: rgb(0, 0, 145); background-color: inherit; ">private</span> Wife m_Wife; <span class="code-keyword" style="color: rgb(0, 0, 145); background-color: inherit; ">public</span> Wife Wife { get { <span class="code-keyword" style="color: rgb(0, 0, 145); background-color: inherit; ">return</span> m_Wife; } set { m_Wife = value; } } } <span class="code-keyword" style="color: rgb(0, 0, 145); background-color: inherit; ">public</span> class Wife { <span class="code-keyword" style="color: rgb(0, 0, 145); background-color: inherit; ">public</span> Wife(string name, <span class="code-object" style="color: rgb(145, 0, 145); background-color: inherit; ">int</span> age) { <span class="code-keyword" style="color: rgb(0, 0, 145); background-color: inherit; ">this</span>.m_name = name; <span class="code-keyword" style="color: rgb(0, 0, 145); background-color: inherit; ">this</span>.m_age = age; } <span class="code-keyword" style="color: rgb(0, 0, 145); background-color: inherit; ">private</span> string m_name; <span class="code-keyword" style="color: rgb(0, 0, 145); background-color: inherit; ">public</span> string Name { get { <span class="code-keyword" style="color: rgb(0, 0, 145); background-color: inherit; ">return</span> m_name; } set { m_name = value; } } <span class="code-keyword" style="color: rgb(0, 0, 145); background-color: inherit; ">private</span> <span class="code-object" style="color: rgb(145, 0, 145); background-color: inherit; ">int</span> m_age; <span class="code-keyword" style="color: rgb(0, 0, 145); background-color: inherit; ">public</span> <span class="code-object" style="color: rgb(145, 0, 145); background-color: inherit; ">int</span> Age { get { <span class="code-keyword" style="color: rgb(0, 0, 145); background-color: inherit; ">return</span> m_age; } set { m_age = value; } } } <span class="code-comment" style="color: rgb(128, 128, 128); background-color: inherit; ">// ****** Program ******
Hi,
Thanks Amjad for the quick response and great example. This is a great feature and one that I plan to make use of in our product. One question: Can there be more than one nested object? If, in your example, the nested object was Kids instead of Wife, could there be more than one and if so how would the values be displayed?
Thank you!
Hi,
http://msdn.microsoft.com/en-us/library/0fss9skc(v=vs.80).aspx
Thanks for the response. but typically we use references to generic Lists as properties. I assume that means that Smart markers will not accept a generic List as a nested object either? See your modified code below:
Thanks!
<!–[if gte mso 9]>
<w:WordDocument>
<w:View>Normal</w:View>
<w:Zoom>0</w:Zoom>
<w:TrackMoves/>
<w:TrackFormatting/>
<w:PunctuationKerning/>
<w:ValidateAgainstSchemas/>
<w:SaveIfXMLInvalid>false</w:SaveIfXMLInvalid>
<w:IgnoreMixedContent>false</w:IgnoreMixedContent>
<w:AlwaysShowPlaceholderText>false</w:AlwaysShowPlaceholderText>
<w:DoNotPromoteQF/>
<w:LidThemeOther>EN-US</w:LidThemeOther>
<w:LidThemeAsian>X-NONE</w:LidThemeAsian>
<w:LidThemeComplexScript>X-NONE</w:LidThemeComplexScript>
<w:Compatibility>
<w:BreakWrappedTables/>
<w:SnapToGridInCell/>
<w:WrapTextWithPunct/>
<w:UseAsianBreakRules/>
<w:DontGrowAutofit/>
<w:SplitPgBreakAndParaMark/>
<w:DontVertAlignCellWithSp/>
<w:DontBreakConstrainedForcedTables/>
<w:DontVertAlignInTxbx/>
<w:Word11KerningPairs/>
<w:CachedColBalance/>
</w:Compatibility>
<w:BrowserLevel>MicrosoftInternetExplorer4</w:BrowserLevel>
<m:mathPr>
<m:mathFont m:val=“Cambria Math”/>
<m:brkBin m:val=“before”/>
<m:brkBinSub m:val="–"/>
<m:smallFrac m:val=“off”/>
<m:dispDef/>
<m:lMargin m:val=“0”/>
<m:rMargin m:val=“0”/>
<m:defJc m:val=“centerGroup”/>
<m:wrapIndent m:val=“1440”/>
<m:intLim m:val=“subSup”/>
<m:naryLim m:val=“undOvr”/>
</m:mathPr></w:WordDocument>
<![endif]–>
public class Individual
{
private String m_Name;
public String Name
{
get { return m_Name; }
set { m_Name = value; }
}
private int m_Age;
public int Age
{
get { return m_Age; }
set { m_Age = value; }
}
internal Individual(string name, int age)
{
this.Name = name;
this.Age = age;
}
private List<Kid> m_Kids;
public List<Kid> Kids
{
get { return m_Kids; }
set { m_Kids = value; }
}
}
public class Kid
{
public Kid(string name, int age)
{
this.m_name = name;
this.m_age = age;
}
private string m_name;
public string Name
{
get { return m_name; }
set { m_name = value; }
}
private int m_age;
public int Age
{
get { return m_age; }
set { m_age = value; }
}
}
//Initialize WorkbookDesigner object
WorkbookDesigner designer = new WorkbookDesigner();
//Load the template file
designer.Workbook = new Workbook("e:\\test2\\SM_NestedObjects.xlsx");
System.Collections.Generic.ICollection<Individual> list = new System.Collections.Generic.List<Individual>();
//Create an object for the Individual class
Individual p1 = new Individual("Damian", 30);
//Create the relevant Wife class for the Individual
p1.Wife = new List();
p1.Wife.Add(new Wife("Dalya", 28));
p1.Wife.Add(new Wife("Dalya2", 28));
//Create another object for the Individual class
Individual p2 = new Individual("Mack", 31);
//Create the relevant Wife class for the Individual
p2.Wife = new List();
p2.Wife.Add(new Wife("Maaria", 29));
//Add the objects to the list
list.Add(p1);
list.Add(p2);
//Specify the DataSource
designer.SetDataSource("Individual", list);
//Process the markers
designer.Process(false);
//Save the Excel file.
designer.Workbook.Save("e:\\test2\\out_SM_NestedObjects.xlsx");
/* Style Definitions */ table.MsoNormalTable {mso-style-name:"Table Normal"; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-style-priority:99; mso-style-qformat:yes; mso-style-parent:""; mso-padding-alt:0in 5.4pt 0in 5.4pt; mso-para-margin:0in; mso-para-margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:11.0pt; font-family:"Calibri","sans-serif"; mso-ascii-font-family:Calibri; mso-ascii-theme-font:minor-latin; mso-hansi-font-family:Calibri; mso-hansi-theme-font:minor-latin; mso-bidi-font-family:"Times New Roman"; mso-bidi-theme-font:minor-bidi;}
<![endif]–>
debfontaine:Thanks for the response. but typically we use references to generic Lists as properties. I assume that means that Smart markers will not accept a generic List as a nested object either?
Thanks for the quick response. We will definitely make use of the simple nested objects - it is a great new feature.
Hi,
Thanks for your posting and using Aspose.Cells for .NET.
It’s good to know that you appreciate this feature of smart markers.
Please feel free to let us know if you face any difficulty using this feature, we will be glad to assist you.
Hi,
Thanks for your posting and considering Aspose.Cells.
Simple nested objects in smart markers are supported in .NET version and not supported in Java version. Please try the code posted by Amjad in the above post.
( Aspose Cells Smartmarkers and nested objects )
If you find any problem, please provide us some simple runnable sample console application project replicating this issue. We will look into your issue and help you asap.
Please also download and try the latest version: Aspose.Cells for .NET 8.6.0 and see if it makes any difference and resolve your issue.
Thank’s for your reply, but what I’m looking for is something like was asked in this post (https://forum.aspose.com/t/105662). That option is not yet supported ?
Hi,
Thanks for your explanation and using Aspose.Cells.
We will analyze this feature and log it in our database for a fix and update you asap.
Hi,
Thanks for using Aspose.Cells.
We have logged your requested feature as a New Feature request in our database to support it. We will look into it and implement it if possible. Once, there is some fix or other update for you, we will let you know asap.
This issue has been logged as
Thank you! We are evaluating to purchase APOSE .CELLS license and this function is very very very important for us.
Hi Marco,
Thanks for your posting and using Aspose.Cells.
We have logged your comment in our database against this issue for product team consideration. Once there is some news for you, we will let you know asap.
Hi,
Thanks for using Aspose.Cells.
This is to inform you that we have fixed your issue CELLSNET-43934 now. We will soon provide the fix after performing QA and including other enhancements and fixes.
The issues you have found earlier (filed as CELLSNET-43934) have been fixed in this update.