reading color information from multiple xls cells
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Hi,
i'm trying to read the Interior.ColorIndex value for multiple cells at once.
it works for 1 cell, but not a range of cells. Any idea how to make this work for more that 1 cell?
handles.ExFileName='r:\Magview\source\data\points.xlsx';
h = actxserver('Excel.Application');
workbook = h.Workbooks.Open(handles.ExFileName);
Sheets = h.ActiveWorkBook.Sheets;
Sheets.Item(1).Activate;
c = h.Range('A1').Interior.ColorIndex % returns 47
c2 = h.Range('A1:A500').Interior.ColorIndex % returns a single NaN
invoke(h, 'Quit');
delete(h)
0 Kommentare
Antworten (1)
Walter Roberson
am 15 Feb. 2022
https://www.mathworks.com/matlabcentral/answers/1622010-how-do-i-select-several-rows-in-excel#answer_868620 shows how to create a union of ranges.
3 Kommentare
Image Analyst
am 15 Feb. 2022
Since a range of cells could be shaded a range of different colors, what do you expect it to return? I suspect there is not API function to handle that and you'll have to process your cells one cell at a time to get each color in turn.
Siehe auch
Kategorien
Mehr zu Spreadsheets finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!