腾讯云个人网站备案,wordpress 时间设置,网站友情链接怎么做,东莞建设网网上平台需求#xff1a;winform 加载 office excel 并加载QRCode图片#xff0c;但是每台PC打印出来QRCode位置都不太一样#xff0c;怎么办呢#xff1f;
我的办法#xff1a;
1、在sheet中插入一个 textbox #xff0c;改名 qrcode #xff08;这个名字随便设置#xff09…需求winform 加载 office excel 并加载QRCode图片但是每台PC打印出来QRCode位置都不太一样怎么办呢
我的办法
1、在sheet中插入一个 textbox 改名 qrcode 这个名字随便设置
2、判断sheet中是否存在名字为qrcode 的textbox
//怎么加载excel代码就省略了bool _isexistQRCodeTextBox false; //sheet中是否存在qrcode 的 textbox
if(sheet.Shapes.Count 0)
{for (int _i 1; _i sheet.Shapes.Count; _i){if (sheet.Shapes.Item(_i).Name qrcode){_isexistQRCodeTextBox true;break;}}
}
if (_isexistQRCodeTextBox)
{var xlsqrcode sheet.TextBoxes(qrcode) as Microsoft.Office.Interop.Excel.TextBox;xlsqrcode.Visible false;PicTop Convert.ToSingle(xlsqrcode.Top);PicLeft Convert.ToSingle(xlsqrcode.Left);var PicWidth Convert.ToSingle(xlsqrcode.Width);var PicHeight Convert.ToSingle(xlsqrcode.Height);//qrfilename是二维码图片的路径图片文件名sheet.Shapes.AddPicture(qrFileName, Microsoft.Office.Core.MsoTriState.msoTrue, Microsoft.Office.Core.MsoTriState.msoTrue, PicLeft, PicTop, PicWidth, PicHeight);}
这样插入一个textbox就可以在每台PC的excel中移动 textbox就可以了