Créer une plage d'union
Contents
[
Hide
]
Créer une plage d’union
Aspose.Cells offre la possibilité de créer Union Range en utilisant leWorksheetCollection.CreateUnionRangeméthode. LeWorksheetCollection.CreateUnionRangeLa méthode accepte deux paramètres, l’adresse pour créer la plage d’union et l’index de la feuille de calcul. LeWorksheetCollection.CreateUnionRange méthode renvoie unGammeUnion objet.
L’extrait de code suivant illustre la création d’une plage d’union à l’aide deWorksheetCollection.CreateUnionRangeméthode. Le fichier de sortie généré par le code est joint pour référence.
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"); |