Tag: ioexception

如何在Laravel 4.2上configuration和使用Box Spout

我需要在Laravel 4.2上configuration和使用Box Spout,但是,库不起作用。 我运行命令来安装Composer依赖关系: composer require box/spout 但是,代码不起作用: $writer = WriterFactory::create(Type::XLSX); // for XLSX files $filePath = public_path() . "/relatorios/test.xlsx"; $writer->openToFile($filePath); $singleRow = ['No'=>1,'Nama'=>'Bayummic','Nilai'=>11,'Nim'=>14140101]; $writer->addRow($singleRow); // add a row at a time $writer->close(); 错误信息: [2016-12-07 17:35:38] production.INFO: D:\Projetos\Testes\LaravelQueues\public [] [] [2016-12-07 17:35:38] production.ERROR: exception 'Box\Spout\Common\Exception\IOException' with message 'Cannot perform I/O operation outside of the base […]

创buildCSV文件时出现偶然IOException“进程无法访问文件…”

我正在通过使用Office.Interop.Excell库创build一个CSV(与';'作为分隔符)文件。 下面的代码在我的计算机上工作正常,但我的客户之一有时得到了IO.Exception:“进程无法访问文件,因为它正在被另一个进程使用”。 奇怪的是,这个错误是不是总是popup,有时它的作品,有时它不… 什么可能是这偶然IO.Exception为我的客户端的原因。 这是我的代码: public static void GenerateCsvFile(DataSet ds, string paramFileFullPath, Dictionary<string, string[]> tableHeaders) { object missing = System.Reflection.Missing.Value; var excel = new Application { DisplayAlerts = false }; Workbook workbook = null; try { workbook = excel.Application.Workbooks.Add(true); foreach (System.Data.DataTable dt in ds.Tables) AddTableSheet(ref workbook, ref excel, dt, true, tableHeaders[dt.TableName], false); workbook.SaveAs(paramFileFullPath, XlFileFormat.xlTextMSDOS, missing, […]

Java与另一个程序打开文件

我想在我的Java程序中打开一个文件,但我不能得到它的工作。 我希望我的程序可以在所有平台上运行,尤其是在Ubuntu上。 这是我有什么: private void openFileChoser() { JFileChooser chooser = new JFileChooser("."); int returnVal = chooser.showOpenDialog(getParent()); if(returnVal == JFileChooser.APPROVE_OPTION) { openFile(chooser.getSelectedFile().getAbsolutePath()); } else { System.out.println("Aucun fichier choisi"); } } /*** * ouverture du fichier : * @param name */ private void openFile(String name) { System.out.println("Ouverture du fichier: " + name); try { Runtime.getRuntime().exec(new String[]{name}); //Desktop.getDesktop().open(new […]

如何阅读在C#打开excel文件

我想用C#读取已经打开的excel文件。 我正在使用这种方法,但它不能读取excel文件,而在Microsoft Excel中打开该文件。 FileStream stream = File.Open("myfile.xlsx", FileMode.Open, FileAccess.Read); 它给出了IOException: The process cannot access the file 'myfile.xlsx' because it is being used by another process. 我希望你明白我的意思。 我想保持excel文件打开,而文件是在Microsoft Excel中打开,我想从C#中读取它。 我正在使用C#net framework 4.0