How to copy the filter results?
How to copy the filter results?
My sample xlsx,
in sheet1:
+|A
1|title
2|1
3|2
4|2
5|1
6|2
7|1
filter the 2, get results:
+|A
1|title
3|2
4|2
6|2
copy filter results to sheet2,
what i want results in sheet2:
+|A
1|title
2|2
3|2
4|2
what i get in sheet2:
+|A
1|
2|1
3|2
4|2
5|1
6|2
7|1
This is my code, Please help me to see what is the problem.
Thinks.
------
class Program
{
static void Main(string[] args)
{
string filePath = @"D:\x.xlsx";
ExcelEngine eg = new ExcelEngine();
IApplication excelApp = eg.Excel;
IWorkbook wb = excelApp.Workbooks.Open(filePath, ExcelOpenType.Automatic);
IWorksheet sheet = wb.Worksheets[0];
sheet.AutoFilters.FilterRange = sheet.UsedRange;
IAutoFilter af = sheet.AutoFilters[0];
af.FirstCondition.DataType = ExcelFilterDataType.String;
af.FirstCondition.String = "2";
IRange usedRange = sheet.UsedRange;
usedRange.CopyTo(wb.Worksheets[1].Range["A1"], ExcelCopyRangeOptions.None);
wb.Save();
wb.Close();
eg.Dispose();
}
}
------
SIGN IN To post a reply.
4 Replies
AV
Abirami Varadharajan
Syncfusion Team
May 4, 2017 11:46 AM UTC
Hi HuangXianwei,
Thank you for contacting Syncfusion support.
As per MS Excel behavior, filtered range cannot be copied to another range. However, we have prepared a sample as per your requirement, which can be downloaded from following location.
Sample Link: http://www.syncfusion.com/downloads/support/directtrac/general/ze/XlsIO_Sample353501835.zip
Kindly refer and let us know that your requirement is fulfilled.
Regards,
Abirami
HU
HuangXianwei
May 4, 2017 02:32 PM UTC
Hi Abirami,
Thank you for your reply.
Your answers and examples are really helpful to me.
Thanks again for your help,
HuangXianwei
AV
Abirami Varadharajan
Syncfusion Team
May 5, 2017 04:29 AM UTC
Hi HuangXianwei,
We are glad that your requirement is fulfilled.
Please let us know if need any further assistance.
Please let us know if need any further assistance.
Regards,
Abirami.
AV
Abirami Varadharajan
Syncfusion Team
May 5, 2017 04:29 AM UTC
Hi HuangXianwei,
We are glad that your requirement is fulfilled.
Please let us know if need any further assistance.
Please let us know if need any further assistance.
Regards,
Abirami.
SIGN IN To post a reply.
- 4 Replies
- 2 Participants
-
HU HuangXianwei
- May 3, 2017 04:24 PM UTC
- May 5, 2017 04:29 AM UTC