Does the Named Range expand with smart markers "shift"?

Hi,

I found the named range will expand as well when smart markers are processed, but if I add parameter “shift” to the markers, the named range doesn’t expand. Is it by design or a bug?

code is attached.
ConsoleApp28.zip (156.5 KB)

Thanks

@4engkai,

Thanks for the sample project with template file.

After an initial test, I am able to observe the issue as you mentioned by using your sample code with your template file. I found that Named range does not expand with Smart Markers “shift” parameter:
e.g
Sample code:

  var wbd = new WorkbookDesigner(); 
            wbd.Workbook = new Workbook("e:\\test2\\NamedRangeTest.xlsx"); 

            var dataTable = new DataTable("TableA"); 
            dataTable.Columns.Add("ColumnA"); 
            dataTable.Columns.Add("ColumnB"); 

            for (var i = 0; i < 5; i++) 
            { 
                var dr = dataTable.NewRow(); 
                dr["ColumnA"] = "ColumnA Value" + i; 
                dr["ColumnB"] = "ColumnB Value" + i; 
                dataTable.Rows.Add(dr); 
            } 

            wbd.SetDataSource(dataTable); 

            wbd.Process(); 

            var ms = new MemoryStream(); 

            wbd.Workbook.Save(ms, SaveFormat.Xlsx); 

            using (FileStream file = new FileStream("e:\\test2\\out1.xlsx", FileMode.OpenOrCreate, FileAccess.Write)) 
            { 
                ms.WriteTo(file); 
            }  

I have logged a ticket with an id “CELLSNET-46057” for your issue. We will look into it soon.

Once we have an update on it, we will let you know here.

@4engkai,

We did evaluate your issue in details.
Please remove the shift parameter if you want to expand the named range. If the shift parameter is used, we have to insert range by each smart marker. The named range is “A1:B1”, we could not expand it when we shift the range “A2:A5” and "B2:B"5 down.

@Amjad_Sahi,

Thanks for your answer. In some case, the “shift” is required, take the attached file (Result.jpg (17.5 KB)) as an example, the 2 data sources has different values, I don’t want them be expanded with the same rows (template.JPG (4.0 KB)).

Is there any other way that I keep the named range expanded and the 2 ranges are not expanded with same rows.

Thanks

@4engkai,

Thanks for the screenshots.

Your details makes sense. I have recorded your findings against your existing issue “CELLSNET-46057”. We will check if we could use some parameter so that both named ranges should not be expanded with same rows (as one of them has less number of records in it).

Once we have an update on it, we will let you know here.

@4engkai

We will shift some areas together if the adjacent smart markers belong to the same data source.

We have fixed your issue i.e. CELLSNET-46057 now. We will provide you fix in next few days after adding some more fixes and enhancements.

@4engkai

Thanks for using Aspose APIs.

Please download and try the following fix for your issue CELLSNET-46057 and let us know your feedback.

The issues you have found earlier (filed as CELLSNET-46057) have been fixed in this update. Please also check the document/article for your reference: Install Aspose Cells through NuGet|Documentation