c# - 命名空间“Aspose.Cells”中不存在类型或命名空间名称“Utility”(您是否缺少程序集引用?)
问题描述
Heyyy..我现在正面临着泡菜。
我需要开发一个程序,其中一个功能是它可以将 JSON 文件转换为 CSV 文件。
这是我所拥有的:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.IO;
using Aspose;
using Aspose.Cells;
namespace WpfApplication1
{
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
}
private void Button_Click(object sender, RoutedEventArgs e)
{
string str = File.ReadAllText(@"C:\cpi\log\V510ResultsInfo\cpi001.json");
Aspose.Cells.Workbook workbook = new Aspose.Cells.Workbook();
Aspose.Cells.Cells cells = workbook.Worksheets[0].Cells;
Aspose.Cells.Utility.JsonLayoutOptions importOptions = new
Aspose.Cells.Utility.JsonLayoutOptions();
importOptions.ConvertNumericOrDate = true;
importOptions.ArrayAsTable = true;
importOptions.IgnoreArrayTitle = true;
importOptions.IgnoreObjectTitle = true;
Aspose.Cells.Utility.JsonUtility.ImportData(str, cells, 0, 0, importOptions);
workbook.Save(@"C:\cpi\log\V510ResultsInfo\convertedjson.csv");
}
}
}
问题是' Aspose.Cells.Utility'中的'Utility ' ..在网上搜索时让我头疼,但似乎没有什么大不了的..
我所知道的是,“Aspose.Cells.Utility.JsonLayoutOptions”位于 Aspose.Cells.dll 中的“Aspose.Cells.Utility”命名空间中。DLL 没有任何问题,一切都很好。只是错误仍然存在:
错误消息:命名空间“Aspose.Cells”中不存在类型或命名空间名称“Utility”(您是否缺少程序集引用?)
解决方案
除了 jayrag 提供的答案之外,我想说的是,Apsose.Cells.Utility 似乎是一个较新的命名空间,因此它不适用于旧版本的 Aspose。我刚刚检查了它的版本 17,它肯定不可用。我在 Aspose.Cells 中也找不到任何可以帮助您的替代方法。似乎对 json 的支持仍然很新,要使用它,您需要升级许可证。鉴于 aspose 的价格,您可能应该采取一种解决方法。希望那些对你有帮助。干杯!
推荐阅读
- python - 在 tensorflow 中调用 CUDA 求解器失败(cuSolverDN 调用失败,状态 =7)
- bison - 为什么我生成的 Flex/Bison 解析器即使添加到规则中也会出现语法错误?
- javascript - JavaScript 对象输出
- node.js - 从 Eclipse 项目启动 node.js NPX
- html - 打字稿调用 HTML id 来改变值
- python - 我将如何单独处理循环索引
- jquery - CSS:从角度获取颜色
- mongodb - MongoDB:用户定义的变量进入查询
- algorithm - 如何通过展开来解决递归关系?
- python - 合并具有某些匹配列名称的数据框会导致重复列