Создать союзный диапазон
Contents
[
Hide
]
Создать союзный диапазон
Aspose.Cells предоставляет возможность создавать Union Range с помощьюWorksheetCollection.CreateUnionRangeметод.WorksheetCollection.CreateUnionRangeМетод принимает два параметра: адрес для создания диапазона объединения и индекс рабочего листа.WorksheetCollection.CreateUnionRange метод возвращаетЮнионРейндж объект.
В следующем фрагменте кода показано создание диапазона объединения с помощьюWorksheetCollection.CreateUnionRangeметод. Выходной файл, сгенерированный кодом, прилагается для справки.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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"); |