إنشاء نطاق الاتحاد

إنشاء نطاق الاتحاد

يوفر Aspose.Cells القدرة على تكوين Union Range باستخدامWorksheetCollection.CreateUnionRangeطريقة. الWorksheetCollection.CreateUnionRangeالطريقة تقبل معلمتين ، العنوان لإنشاء نطاق الاتحاد وفهرس ورقة العمل. الWorksheetCollection.CreateUnionRange طريقة إرجاع أUnionRange موضوع.

يوضح مقتطف التعليمات البرمجية التالي إنشاء نطاق الاتحاد باستخدامWorksheetCollection.CreateUnionRangeطريقة. يتم إرفاق ملف الإخراج الذي تم إنشاؤه بواسطة الرمز كمرجع.

// For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-.NET
// Working directories
string SourceDir = RunExamples.Get_SourceDirectory();
string outputDir = RunExamples.Get_OutputDirectory();
Workbook workbook = new Workbook(SourceDir + "SamplePowerQueryFormula.xlsx");
DataMashup mashupData = workbook.DataMashup;
foreach (PowerQueryFormula formula in mashupData.PowerQueryFormulas)
{
foreach (PowerQueryFormulaItem item in formula.PowerQueryFormulaItems)
{
if (item.Name == "Source")
{
item.Value = "Excel.Workbook(File.Contents(\"" + SourceDir + "SamplePowerQueryFormulaSource.xlsx" + "\"), null, true)";
}
}
}
// Save the output workbook.
workbook.Save(outputDir + "SamplePowerQueryFormula_out.xlsx");