Smart markers and multiple datasets

@neharai,

Please see the following sample code for your reference. Please try it with the attached file, it will work for your needs.
e.g.
Sample code:

//Instantiating a Workbook object
        Workbook workbook = new Workbook("e:\\test2\\Bk_formattingtextbased1.xlsx");
        Worksheet sheet = workbook.Worksheets[0];
        int index = sheet.ConditionalFormattings.Add();
        FormatConditionCollection fcs = sheet.ConditionalFormattings[index];
        //Sets the conditional format range (B2:B5).
        CellArea ca = new CellArea();
        ca.StartRow = 1;
        ca.EndRow = 4;
        ca.StartColumn = 1;
        ca.EndColumn = 1;
        fcs.AddArea(ca);
        //Adds condition.
        int conditionIndex1 = fcs.AddCondition(FormatConditionType.ContainsText);
        fcs[conditionIndex1].Text = "@gmail.com";

        //Sets the font color.
        FormatCondition fc1 = fcs[conditionIndex1];
        fc1.Style.Font.Color = Color.Red;
        
        //Saving the Excel file
        workbook.Save("e:\\test2\\conddoutput1.xlsx");

Please refer to above code, so you may write your own code accordingly.

Hope, this helps a bit.
files1.zip (7.2 KB)

Hi Team,

I want to make that entire row red not just that particular cell which has fcs[conditionIndex1].Text = “@gmail.com”;.
Please suggest what needs tp be changed for that ?

Thanks,
Neha

@neharai,

Well, in that case, you have to find out each cell containing “@gmai.com”. Now get the row index from the found cell and apply formatting to the entire row either by Cells.ApplyRowStyle() or apply formatting cell by cell (separately) in that row. See the document on how to use Find and search data options via Aspose.Cells APIs.

The issues you have found earlier (filed as CELLSNET-47888) have been fixed in this update. This message was posted using Bugs notification tool by simon.zhao

Can you please give any example about how to leverage this now?

@neharai,

We will soon prepare an example to share it with you here for your reference.

Any rough idea by when ? Asking Because I have deliverable related to this.

@neharai,

Probably we can share the sample in the next couple of days.

1 Like

@neharai,
1: Now we have supported working as expected without copying range, please check the attached code.txt and 47888.xlsx.
The template file contains a named range “_CellsSmartMarkers”.
2: If you want to make that entire row red, please check Find or Search Data|Documentation

See following codes:

Style style = workbook.CreateStyle();
style.Pattern = BackgroundType.Solid;
style.ForegroundColor = Color.Red;
StyleFlag styleFlag = new StyleFlag();
styleFlag.CellShading = true;
Cells cells = workbook.Worksheets[0].Cells;
Cell cell = null;
while(true) {
cell = cells.Find("@gmail.com", cell);
if(cell == null) {
break;
}
cells.ApplyRowStyle(cell.Row, style, styleFlag);
} 

47888.zip (36.3 KB)

Let us know your feedback.

Please give me access to download the file.

@neharai,
You may please try to download the file here:
https://www.dropbox.com/s/zcah9t3r0hxe59k/47888.zip?dl=0

It says it has been deleted from this location

Hi Team , can u please attach the solution file again as It been deleted from source.

@neharai,
Please try downloading it from this link and let us know your feedback.

It says does not contain the defination of LineByLine , do I have to download nay new dll for this?

Also If I want to add extra field Department.Students.ExtraClasses where ExtraClasses is again a list for each student then how should I proceed :-
Entity will be:-
List ExtraClasses = new List();
ExtraClass ExtraClass1=new ExtraClass();
ExtraClass1.ClassName=“Physics”;
ExtraClass1.ForStudent="student1 ";
ExtraClass1.ClassId=“1D”;
ExtraClass2.ClassName=“Physics”;
ExtraClass2.ForStudent="student1 ";
ExtraClass2.ClassId=“1D”;
ExtraClass1.Add(ExtraClass1);
ExtraClass1.Add(ExtraClass2);
List students = new List();
Student student1 = new Student();
student1.EmailId = "ewe@kkk.com";
student1.Name = “Jimit”;
student1.PhoneNumber = “1213123213”;
student1.ExtraClasses =ExtraClasses ;
Student student2 = new Student();
student2.EmailId = "ewe@kkk.com";
student2.Name = “Jimit”;
student2.PhoneNumber = “1213123213”;
Student student3 = new Student();
student3.EmailId = "ewe@kkk.com";
student3.Name = “Jimit”;
student3.PhoneNumber = “1213123213”;
students.Add(student1);
students.Add(student2);
students.Add(student3);

image.png (11.6 KB)

Please suggest ASAP, I have already downloaded
Aspose.Cells for .NET 21.4 (DLLs Only) but my .net framework is 4.7.2 looks like its not available for this one, below warning is coming -
image.png (19.2 KB)

@neharai,
Here is a sample project where Aspose.Cells for .NET 21.4 dll is added and targets .NET framework 4.7.2. No issue is observed and LineByLine is also compiled successfully. Please give it a try and share the feedback.

It does not work as I expected it to work , it still showing all list together . You can try in any MVC 4.7.2 asp.net framework.
Note -Also this new version of 21.4 doesn’t come in nuget.

How to achieve below one :

List departments = new List();
List students = new List();
List issues = new List();
issues.Add(new Issue { IssueName = “12”, IssueID = 1 });
issues.Add(new Issue { IssueName = “13”, IssueID = 2 });
issues.Add(new Issue { IssueName = “14”, IssueID = 3 });
Student student1 = new Student();
student1.EmailId = "ewe@kkk.com";
student1.Name = “Jimit”;
student1.PhoneNumber = “1213123213”;
student1.Issues = issues;
Student student2 = new Student();
student2.EmailId = "ewe@kkk.com";
student2.Name = “Jimit”;
student2.PhoneNumber = “1213123213”;
Student student3 = new Student();
student3.EmailId = "ewe@kkk.com";
student3.Name = “Jimit”;
student3.PhoneNumber = “1213123213”;
student3.Issues = issues;
students.Add(student1);
students.Add(student2);
students.Add(student3);

        Department department1 = new Department();
        department1.Name = "Science";
        department1.ProfessorName = "C.V";
        department1.EmailId = "gh@hwe.com";
        department1.Subject = "Physics";
        department1.Students = students;

        Department department2 = new Department();
        department2.Name = "History";
        department2.ProfessorName = "CR.V";
        department2.EmailId = "wew@hwe.com";
        department2.Subject = "Ancient History";
        department2.Students = students;

        departments.Add(department1);
        departments.Add(department2);