フィルターのクリア

how can we read excel file with cells colors, format and having image?

5 ビュー (過去 30 日間)
azizullah khan
azizullah khan 2014 年 9 月 8 日
編集済み: Joseph Cheng 2014 年 9 月 8 日
Want to read excel file with cells colors and with cell format (formulas etc) and the excel file also contain images.Kindly share your experience with me.I tried a lot but doesn't succeed.Thanks.
  2 件のコメント
Geoff Hayes
Geoff Hayes 2014 年 9 月 8 日
Azizullah - why is getting the cell colour and format important? What are you trying to do with this information?
azizullah khan
azizullah khan 2014 年 9 月 8 日
Just make an experience with that..If you have any idea share it with me...Thanks for comment.

サインインしてコメントする。

回答 (1 件)

Joseph Cheng
Joseph Cheng 2014 年 9 月 8 日
編集済み: Joseph Cheng 2014 年 9 月 8 日
So i try not to do this and live in one world but these things can be achieved through the ActiveX server.
Say for instance i create a simple excel file called testxlsx.xlsx. column A is just the number 1 through 10. Column B is 2*Column A, Column C is 3*Column A -3, etc. where Column A is a constant and B onward is formula. Then color pattern it with something.
Now if you go.
xl = actxserver('excel.application'); %open activex server
xl.visible = 1; %make things visible
wb = xl.Workbooks.Open('C:\temps\testxlsx.xlsx'); %open specified xlsx file
wbSheet1 = wb.Sheets.Item('Sheet1'); %specify sheet
robj = wbSheet1.Columns.End(4); % Find the end of the column
numrows = robj.row; % And determine what row it is
dat_range = ['C1']; % Read any cell
rngObj = wbSheet1.Range(dat_range); %set that as active cell(s)
get(rngObj.interior) %get interior values. %see that color is dec value. convert to hex and see it as the #FFFFFF type of color.
CellObj = get(rngObj);
Then if you peek inside CellObj for the line above you'll see that the excel formula is stored in
Formula: '=B1*3-A1'
FormulaArray: '=B1*3-A1'
FormulaHidden: 0
FormulaLocal: '=B1*3-A1'
FormulaR1C1: '=RC[-1]*3-RC[-2]'
FormulaR1C1Local: '=RC[-1]*3-RC[-2]'
I do not know how to mass do this without going cell by cell and extracting the data.
oh and finding + extracting the plots is something i never figured out where that is located.

カテゴリ

Help Center および File ExchangeSpreadsheets についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by