Foxtable(狐表)用户栏目专家坐堂 → 按照帮助引用了dll及定义了命名空间但是不行


  共有4292人关注过本帖树形打印复制链接

主题:按照帮助引用了dll及定义了命名空间但是不行

帅哥哟,离线,有人找我吗?
jiangxun
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:四尾狐 帖子:876 积分:5929 威望:0 精华:0 注册:2014/8/3 12:15:00
按照帮助引用了dll及定义了命名空间但是不行  发帖心情 Post By:2016/12/8 9:19:00 [只看该作者]

定义了命名空间ReoGrid

但是如下代码不行,请求帮助


Dim grid As New ReoGrid.MyReoGridControl()
grid.Dock =  ReoGrid.DockStyle.Fill
e.Form.Panel.Controls.Add(grid)

 

提示:未定义类型“”ReoGrid.MyReoGridControl() “”

 

 

 


此主题相关图片如下:qq截图20161208091413.jpg
按此在新窗口浏览图片

此主题相关图片如下:qq截图20161208091503.jpg
按此在新窗口浏览图片

Installation

Install via NuGet

ReoGrid for Windows Form

To install ReoGrid Windows Form standard edition, use the NuGet command:

PM> Install-Package unvell.ReoGrid.dll

ReoGrid for WPF

PM> Install-Package unvell.ReoGridWPF.dll

Install Visual Studio Toolbox Shortcut for Windows Forms

To add a shortcut on Visual Studio toolbox, perform the following steps:

  1. Right-click on Toolbox panel, click ‘Choose Items…’
    267
  2. Choose ‘.NET Framework Components tab’
  3. Click ‘Browse…’ button
  4. Choose ‘unvell.ReoGrid.dll’ in open file dialog
    268
  5. Click OK button to close the dialog
  6. Click on the item ReoGridControl appeared at most bottom of toolbar to make it selected:

12

Select a range on form designer, when mouse released the ReoGrid spreadsheet component will be added as below:

13

Add Control by Programming for Windows Forms

ReoGrid provides different features set editions, and each edition has different reference requirements. Add the references according to edition used in Application.

  • Minimum Edition – Minimum feature set (no formula calculation supported)
  • Standard Release Edition – Standard features (Recommended)
  • Extension Edition – Extended features, including script language execution integration (like VBA)
DLL Name Description Minimum
Edition
Standard
Release Edition
Extension
Edition
unvell.ReoGrid.dll ReoGrid component library Required Required Required
unvell.ReoScript.dll .NET script language engine Required
Antlr3.Runtime.dll ANTLR grammar tool run-time Required
FastColoredTextBox.dll Powerful colored highlight text editor Required

If not sure which edition to use, Standard Release Edition with single DLL (unvell.ReoGrid.dll) is recommended.

Add Windows Form Control in C#

1. Import namespaces:

using unvell.ReoGrid;

2. Create ReoGrid instance and add it into any windows form container, such as Form or Panel.

var grid = new unvell.ReoGrid.ReoGridControl()
{
  Dock = DockStyle.Fill,
};

this.Controls.Add(grid);  // add to form or panel

Learn more about workbook and worksheet.

Add Windows Form Control in VB.NET

1. Import namespaces:

Imports unvell.ReoGrid

2. Create ReoGrid instance and add it into any windows form container, such as Form or Panel.

Dim grid As New MyReoGridControl() With {.Dock = DockStyle.Fill}
Me.Controls.Add(grid)

Add Control in XAML for WPF Applications

Add ReoGrid DLL reference for target project, edit the XAML file of main window as below:

File MainWindow.xaml:

<Window
  xmlns="/schemas.microsoft.com/winfx/2006/xaml/presentation"
  xmlns:x="/schemas.microsoft.com/winfx/2006/xaml"
  xmlns:rg="clr-namespace:unvell.ReoGrid;assembly=unvell.ReoGrid"
  x:Class="WPFDemo.MainWindow" Title="MainWindow" Height="640" Width="800">
  <Grid>

    <rg:ReoGridControl x:Name="grid" >
    </rg:ReoGridControl>

  </Grid>
</Window>

Example: WPF Design Time

327

For more about WPF edition, see WPF support.

Getting Started

To install ReoGrid into .NET applications, see installation.

Component Overview

215

Usually used objects:

Workbook and Worksheet

The control itself is also workbook, a control (workbook) contains multiple worksheets.

161

Call control (workbook) APIs:

var grid = this.reoGridControl;
grid.fun();

Call worksheet APIs:

var sheet = grid.CurrentWorksheet;
sheet.fun();

Access worksheet

Worksheet provides a lot of methods that could be used to manage cells data, styles, borders, outlines, ranges, formula calculation and etc. The below is an example that demos how to set cells data by call worksheet API.

Set cells data using worksheet index property:

// get current active worksheet instance
var sheet = grid.CurrentWorksheet;

// set cells data
sheet["A1"] = "hello world";
sheet[2, 1] = 10;

Or call SetCellData method:

sheet.SetCellData(new CellPosition(2, 1), "hello world");

Learn more about worksheet.

Access by doing actions

Action is undo-framework provided by ReoGrid core, many operations could be done by doing actions. Operations done via actions could be revoke by call Undo method of control. To do operations by using action:

1. Import this namespace:

using unvell.ReoGrid.Actions;

2. Call DoAction method of grid control

grid.DoAction(grid.CurrentWorksheet, new xxxxAction(...));

To undo or redo actions:

grid.Undo();
grid.Redo();

Repeatedly do last action, apply it to another range:

grid.RepeatLastAction(new RangePosition(2, 3, 5, 5));

Run script

In Extension edition, the ECMAScript-like script execution functionality is supported. It provides the ability to run script language in ReoGrid. Learn more about Script Execution.

To use this feature, make sure the required reference libraries are added into project. see Install.

To run script:

Import the namespace:

using unvell.ReoScript;

Call workbook API to run script:

string script = "workbook.currentWorksheet.getCell("B1").data = 'hello world';";
grid.RunScript(script);

The user applications can extend the script functions and objects to provide own customize script features, see Customize Function.


 


 回到顶部
帅哥哟,离线,有人找我吗?
jiangxun
  2楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:四尾狐 帖子:876 积分:5929 威望:0 精华:0 注册:2014/8/3 12:15:00
  发帖心情 Post By:2016/12/8 9:22:00 [只看该作者]


图片点击可在新窗口打开查看此主题相关图片如下:qq截图20161208092022.jpg
图片点击可在新窗口打开查看

图片点击可在新窗口打开查看此主题相关图片如下:qq截图20161208092038.jpg
图片点击可在新窗口打开查看

 回到顶部
帅哥哟,离线,有人找我吗?
Hopenight
  3楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:四尾狐 帖子:861 积分:10830 威望:0 精华:0 注册:2016/5/6 14:34:00
  发帖心情 Post By:2016/12/8 9:23:00 [只看该作者]

咋不试试葡萄城的Spread呢?

期待你试用后的经验分享哟..


 回到顶部
帅哥哟,离线,有人找我吗?
有点蓝
  4楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:超级版主 帖子:109515 积分:557243 威望:0 精华:9 注册:2015/6/24 9:21:00
  发帖心情 Post By:2016/12/8 9:30:00 [只看该作者]

那用完整的命名空间有没有问题?

Dim grid As new unvell.ReoGrid.ReoGridControl()

 回到顶部
帅哥哟,离线,有人找我吗?
jiangxun
  5楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:四尾狐 帖子:876 积分:5929 威望:0 精华:0 注册:2014/8/3 12:15:00
  发帖心情 Post By:2016/12/8 21:46:00 [只看该作者]

Dim grid As new unvell.ReoGrid.ReoGridControl()
grid.Dock =  unvell.ReoGrid.DockStyle.Fill
e.Form.Panel.Controls.Add(grid)

 

 


图片点击可在新窗口打开查看此主题相关图片如下:qq截图20161208214355.jpg
图片点击可在新窗口打开查看

还是不行,请指导


 回到顶部
帅哥哟,离线,有人找我吗?
有点蓝
  6楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:超级版主 帖子:109515 积分:557243 威望:0 精华:9 注册:2015/6/24 9:21:00
  发帖心情 Post By:2016/12/8 21:51:00 [只看该作者]

下载源码,或者到vs引用这些dll,查看准确的命名空间。

 回到顶部
帅哥哟,离线,有人找我吗?
jiangxun
  7楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:四尾狐 帖子:876 积分:5929 威望:0 精华:0 注册:2014/8/3 12:15:00
  发帖心情 Post By:2016/12/8 23:27:00 [只看该作者]

Dim grid As new FarPoint.Win.Spread.Design
grid.Dock = FarPoint.Win.Spread.Design.DockStyle.Fill
e.Form.Panel.Controls.Add(grid)

换成spread还是导不进来,请帮助

 

 


图片点击可在新窗口打开查看此主题相关图片如下:qq截图20161208232404.jpg
图片点击可在新窗口打开查看

 

 


 


图片点击可在新窗口打开查看此主题相关图片如下:qq截图20161208232536.jpg
图片点击可在新窗口打开查看

 


 


图片点击可在新窗口打开查看此主题相关图片如下:qq截图20161208232553.jpg
图片点击可在新窗口打开查看

 回到顶部
帅哥哟,离线,有人找我吗?
jiangxun
  8楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:四尾狐 帖子:876 积分:5929 威望:0 精华:0 注册:2014/8/3 12:15:00
  发帖心情 Post By:2016/12/8 23:46:00 [只看该作者]

Dim sp As new FarPoint.Win.Spread.FpSpread
sp.Dock =  FarPoint.Win.Spread.DockStyle.Fill
e.Form.panel.controls.Add(sp)

 

也是没有通过

 

 


图片点击可在新窗口打开查看此主题相关图片如下:qq截图20161208234437.jpg
图片点击可在新窗口打开查看

 回到顶部
帅哥哟,离线,有人找我吗?
有点蓝
  9楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:超级版主 帖子:109515 积分:557243 威望:0 精华:9 注册:2015/6/24 9:21:00
  发帖心情 Post By:2016/12/9 8:40:00 [只看该作者]

看6楼,安装一个vs查看属性的正确命名空间,这是使用第三方组件必备的。

DockStyle.Fill应该是system.windows.forms.DockStyle.Fill

很多属性是.net就有的,和组件没有关系,不要生搬硬套

 回到顶部
帅哥哟,离线,有人找我吗?
Hopenight
  10楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:四尾狐 帖子:861 积分:10830 威望:0 精华:0 注册:2016/5/6 14:34:00
  发帖心情 Post By:2016/12/9 11:56:00 [只看该作者]


图片点击可在新窗口打开查看此主题相关图片如下:qq图片20161209115507.png
图片点击可在新窗口打开查看

 回到顶部