添加字库数据 - ImportDictWord
函数简介
将指定的字库图片文件导入到OLA数据库中。
接口名称
ImportDictWord
DLL调用
int ImportDictWord(long ola, long db, string dict_name, string pic_file_name, int cover);
参数说明
| 参数名 | 类型 | 说明 |
|---|---|---|
| ola | 长整数型 | OLAPlug对象的指针,由 CreateCOLAPlugInterFace 接口生成。 |
| db | 长整数型 | 数据库对象指针,由 OpenDatabase 接口返回。 |
| dict_name | 字符串 | 字库名称 |
| pic_file_name | 字符串 | 要导入的图像文件名 |
| cover | 整数型 | 是否覆盖已存在的图像数据,1 覆盖,0 不覆盖 |
示例
C++
long instance = CreateCOLAPlugInterFace();
long db = OpenDatabase(instance, "dict.db");
// 将单个字库图片导入数据库,覆盖已有数据
int ret = ImportDictWord(instance, db, "mydict", "A.bmp", 1);
Python
# 待补充
返回值
1 成功,0 失败。
注意事项
- 适用于单个字库图像文件的导入场景
cover设置为 1 时会覆盖现有数据,设置为 0 时会跳过已存在的图像- 如果导入失败,可以通过 GetDatabaseError 函数获取详细的错误信息
- 确保文件名正确,且图像文件格式受支持
