怎么样让excel里的图片链接直接显示出来,
答案:4 悬赏:60 手机版
解决时间 2021-02-11 18:26
- 提问者网友:孤凫
- 2021-02-11 09:19
意思是虽然输入的是图片链接,但让它直接显示出图片
最佳答案
- 五星知识达人网友:鸠书
- 2021-02-11 09:27
本身的功能和函数都不行。要做只能写程序,现成的是MFC+VB做的,如下:
#import "G:\Program Files\Common Files\Microsoft Shared\OFFICE11\MSO.DLL "
#import "G:\Program Files\Common Files\Microsoft Shared\VBA\VBA6\VBE6EXT.OLB "
#import "G:\Program Files\Microsoft Office\OFFICE11\EXCEL.EXE " rename( "RGB ", "ExcelRGB ") rename( "Delete ", "ExcelDelete ") rename( "DialogBox ", "ExcelDialogBox ")
void Cexcel_picDlg::OnBnClickedOk()
{
// insert picture to excel
// environment: vc2003, excel2003, windows2003
using namespace Excel;
_variant_t covOptional((long)DISP_E_PARAMNOTFOUND,VT_ERROR);
DWORD dwStartTime = GetTickCount();
_ApplicationPtr app;//( "Excel.Application ");
HRESULT hr = S_OK;
CLSID clsid;
CLSIDFromProgID(L "Excel.Application ", &clsid);
app.CreateInstance(clsid);
WorkbooksPtr books;
_WorkbookPtr book;
long lcid =LOCALE_USER_DEFAULT;
SheetsPtr sheets;
app-> get_Workbooks(&books);
book = books-> Add(covOptional,lcid);
book-> get_Worksheets(&sheets);
IDispatchPtr pDisp;
sheets-> get_Item(_variant_t((short)1),&pDisp);
_WorksheetPtr sheet(pDisp);
RangePtr range = sheet-> GetRange(_variant_t( "A1 "),_variant_t( "A1 "));
range-> Value2 = "aaa ";
LPCSTR m_Path = _T( "C:\\flower8.jpg ");
PicturesPtr pics = sheet-> Pictures();
pics-> Insert(m_Path,VARIANT_FALSE);
app-> put_AskToUpdateLinks(lcid,VARIANT_FALSE);
app-> put_AlertBeforeOverwriting(lcid,VARIANT_FALSE);
app-> put_UserControl(VARIANT_FALSE);
app-> put_DisplayAlerts(0,VARIANT_FALSE);
LPCTSTR file_name = _T( "c:\\aa.xls ");
_variant_t varfilename(file_name);
DeleteFile(file_name);
HRESULT hrMethod = book-> SaveAs(varfilename,covOptional,covOptional,covOptional,covOptional,covOptional,xlNoChange);
book-> put_Saved(0,VARIANT_TRUE);
book-> Close(COleVariant(VARIANT_FALSE));
books-> Close();
app-> Quit();
}
#import "G:\Program Files\Common Files\Microsoft Shared\OFFICE11\MSO.DLL "
#import "G:\Program Files\Common Files\Microsoft Shared\VBA\VBA6\VBE6EXT.OLB "
#import "G:\Program Files\Microsoft Office\OFFICE11\EXCEL.EXE " rename( "RGB ", "ExcelRGB ") rename( "Delete ", "ExcelDelete ") rename( "DialogBox ", "ExcelDialogBox ")
void Cexcel_picDlg::OnBnClickedOk()
{
// insert picture to excel
// environment: vc2003, excel2003, windows2003
using namespace Excel;
_variant_t covOptional((long)DISP_E_PARAMNOTFOUND,VT_ERROR);
DWORD dwStartTime = GetTickCount();
_ApplicationPtr app;//( "Excel.Application ");
HRESULT hr = S_OK;
CLSID clsid;
CLSIDFromProgID(L "Excel.Application ", &clsid);
app.CreateInstance(clsid);
WorkbooksPtr books;
_WorkbookPtr book;
long lcid =LOCALE_USER_DEFAULT;
SheetsPtr sheets;
app-> get_Workbooks(&books);
book = books-> Add(covOptional,lcid);
book-> get_Worksheets(&sheets);
IDispatchPtr pDisp;
sheets-> get_Item(_variant_t((short)1),&pDisp);
_WorksheetPtr sheet(pDisp);
RangePtr range = sheet-> GetRange(_variant_t( "A1 "),_variant_t( "A1 "));
range-> Value2 = "aaa ";
LPCSTR m_Path = _T( "C:\\flower8.jpg ");
PicturesPtr pics = sheet-> Pictures();
pics-> Insert(m_Path,VARIANT_FALSE);
app-> put_AskToUpdateLinks(lcid,VARIANT_FALSE);
app-> put_AlertBeforeOverwriting(lcid,VARIANT_FALSE);
app-> put_UserControl(VARIANT_FALSE);
app-> put_DisplayAlerts(0,VARIANT_FALSE);
LPCTSTR file_name = _T( "c:\\aa.xls ");
_variant_t varfilename(file_name);
DeleteFile(file_name);
HRESULT hrMethod = book-> SaveAs(varfilename,covOptional,covOptional,covOptional,covOptional,covOptional,xlNoChange);
book-> put_Saved(0,VARIANT_TRUE);
book-> Close(COleVariant(VARIANT_FALSE));
books-> Close();
app-> Quit();
}
全部回答
- 1楼网友:往事隔山水
- 2021-02-11 12:22
现在excel是连接,你要改为图片?
改为图片就是将图片复制至excel,
因为图片是很占空间的,几千张的图片,应该是不可以的。
图片放在文件夹里,以小图标方式查看不是很好吗?
- 2楼网友:一袍清酒付
- 2021-02-11 10:46
输入图片的连接,你直接插入图片不就好了吗?难道你的图片还是在网络在线的。
- 3楼网友:一袍清酒付
- 2021-02-11 10:31
用VBA可以实现,但不知道具体格式,不好写
我要举报
如以上回答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
点此我要举报以上问答信息
大家都在看
推荐资讯