通过C#在excel中滚动行 [英] Scroll row in excel through C#

查看:365
本文介绍了通过C#在excel中滚动行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,

我有通过Interop创建的Excel表格(C#)

有2张,表单1有客户名(比如1000)作为超链接,点击链接后它移动到第二张。

我希望单元格移动(sheet2)显示在顶部(第一行)

我的代码是这样的

Hello,
I have excel sheet created via Interop (C#)
having 2 sheets,sheets 1 has customername(say 1000) as hyperlink,after click on link it moves to 2nd sheet.
I want the cell to moved(of sheet2) to display on top(first row)
My code is like this

strCol = (char)(asciiChar) + rowNumber.ToString();
range = sheet.get_Range(strCol, strCol);
sheet.Hyperlinks.Add(range, "#" + sheet1.Name + "!C" + moveToRow, Type.Missing, "Go to", dsCustomer.Tables[0].Rows[i][1].ToString());0].Rows[i][1].ToString());





让我们看看。

在表1中有1k客户列表和链接,我必须填写我在sheet2中分配给客户的项目的销售数据,现在如果在row1上显示的每个客户cust1的项目为100,那么在103行上有100个项目行和第二个客户,依此类推。 br />
当我从sheet1点击第二个客户时,它会转到sheet2中的第103行,并在屏幕的中间或下方显示,用户想要滚动它以插入数据。

我的要求是我的第103行应显示在工作表的顶部,因此无需滚动。

非常感谢您的帮助。

提前致谢



lets see.
in sheet 1 i have 1k customerlist with link, i have to fill sales data for items assigned to customer which i placed in sheet2 ,now if items are 100 for each customer cust1 displayed on row1 then 100 items rows and 2nd customer on row 103 and so on.
When i click on 2nd customer from sheet1 it goes to 103rd row in sheet2 and it display in middle or below in the screen and user wants to scroll it for inserting data.
My requirement is my 103rd row should displayed on top of the sheet so no need to scroll.
Your help is appreciated.
Thanks in advance

推荐答案

hi,





在指定的单元格上使用set cursor很简单。你知道你想在顶部显示哪个单元格。



例如你已经选择了单元格的范围



strCol =A103;



range = sheet.get_Range(strCol,strCol);

ranse.select ();





试试这个它会起作用。





问候,

Prakash.T



It is simple to using set cursor on that specified cell. U know that which cell u want to show on the top.

For an example u have select the range of the cell

strCol="A103";

range = sheet.get_Range(strCol, strCol);
ranse.select();


Try this it will work.


Regards,
Prakash.T


这篇关于通过C#在excel中滚动行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆