简体   繁体   English

Excel保存文件,但在打开文件时引发错误:“我们在…中发现了一些内容的问题”

[英]Excel saves file, but throws error on opening it: “We found a prob-lem with some content in …”

I was able to save a workbook, but then when I reopened it, Excel complained, "We found a problem with some content in 'filename'. Do you want us to try to recover as much as we can? If you trust the source of this workbook, click Yes." 我能够保存一个工作簿,但是当我重新打开它时,Excel抱怨说:“我们在'文件名'中发现了一些内容问题。您是否希望我们尝试尽可能地恢复?如果您信任源文件,在此工作簿中,单击“是”。

"Yes" (ie, recover) causes offending Drawings/Shapes/Charts to be deleted. “是”(即,恢复)将导致违规的工程图/图形/图表被删除。

The following describes the cause of my problem and its cure. 以下描述了我的问题的原因及其解决方法。

I had a user-defined worksheet function (UDF) that returned an array of values that was displayed in a chart. 我有一个用户定义的工作表函数(UDF),该函数返回了在图表中显示的值的数组。

The UDF was setting some of these values to the impossible value of 2.69653970229349E+308 (apparently a dll was returning 1.#QNAN which Excel turned into 2.69653970229349E+308). UDF将其中一些值设置为2.69653970229349E + 308的不可能值(显然dll返回1.#QNAN,Excel转换为2.69653970229349E + 308)。

Amazingly, Excel allowed this value to be saved in the cell, and the workbook to be saved. 令人惊讶的是,Excel允许将此值保存在单元格中,并保存工作簿。 However, when opening the workbook, the error was received, and the offending chart was deleted during the "recovery". 但是,在打开工作簿时,收到错误,并且在“恢复”期间删除了有问题的图表。

The cure was to ensure only realistic values are displayed in a chart. 解决办法是确保图表中仅显示实际值。

Here is code redacted from the rather large VBA project. 这是从相当大的VBA项目中删除的代码。

'Global array, Values returned by the UDF
Public MainReturnValues(1 To 57, 1 To 2) As Variant

Public Function MainWorksheetFunction( _
      i_rRangeWithInputData As Range _
      ) As Variant

   '[... Process input data ...]

   'Load global array MainReturnValues(,), i.e., values returned by the UDF
   LoadMainWorksheetFunctionReturnValues

   'Now load UDF return values
   MainWorksheetFunction = MainReturnValues

End Function

'Load global array MainReturnValues(,), i.e., values returned by the UDF
Private Function LoadMainWorksheetFunctionReturnValues( _
      ) As Boolean

   Dim l_vErrNull As Variant
   Dim l_dChartXs(1 To 57) As Double, _
       l_dChartYs(1 To 57) As Double
   Dim c As Long, _
       r As Long

   '~~~~~~~ First fill area with xlErrNull to Prevent Log Chart Graphing 0 Errors
   '~~~~~~~ Excel will "pick up the pen" when cells contain CVErr(xlErrNull)
   l_vErrNull = CVErr(xlErrNull)
   For r = LBound(MainReturnValues, 1) To UBound(MainReturnValues, 1)
      For c = LBound(MainReturnValues, 2) To UBound(MainReturnValues, 2)
         MainReturnValues(r, c) = l_vErrNull
      Next c
   Next r
   '~~~~~~~ End First fill area with xlErrNull ~~~~~~~

   '[... Load values into l_dChartXs() and l_dChartYs() using C# dll ...]

   For r = 1 To 57

      'Don't try to plot ridiculous values. I suspect this causes this error:
      '"We found a problem with some content in 'aaa.xlsb'. Do you want us to try to recover as much as we can? If you trust the source of this workbook, click Yes."
      On Error Resume Next 'Catch 1.#QNAN
      If ((l_dChartXs(r) > 1E+308) Or (l_dChartYs(r) > 1E+308)) Then

      Else 'Value is not ridiculous
         On Error GoTo 0

         'Xs in first column
         MainReturnValues(r, 1) = l_dChartXs(r)

         'Ys in second column
         MainReturnValues(r, 2) = l_dChartYs(r)
      End If
   Next r

   LoadMainWorksheetFunctionReturnValues = True
Exit Function

I hope this helps someone. 我希望这可以帮助别人。

I tried looking solution for this all over the internet ,My Workbook was rather simple system generated .xls file with no shapes and chart, Excel was able to save it as .xlsx but was unable to open it without recovering contents 我尝试在整个Internet上寻找解决方案,我的工作簿是相当简单的系统生成的.xls文件,没有形状和图表,Excel能够将其保存为.xlsx,但无法打开它而没有恢复内容

I end up saving file as CSV and then later saved that CSV as xlsx I thought since CSV is almost like a text file with comma seprated values this might work for simple sheets with values 我最终将文件另存为CSV,然后又将其另存为xlsx,我认为这是因为CSV几乎就像是带有逗号分隔值的文本文件,这可能适用于带有值的简单工作表

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Python 读取 Excel 文件时出现错误 - “我们发现某些内容有问题……” - Python Read Excel file with Error - “We Found a problem with some content…” 将数据框写入现有 Excel 文件中的多个工作表。 打开 excel 文件时出现“我们发现 X.xlsx 中的某些内容有问题” - Writing dataframes to multiple sheets in existing Excel file. Get 'We Found Problem with some content in X.xlsx' when opening excel file 如何在使用 Apache POI 打开 Excel 时修复错误。 错误提示“我们发现 xyz.xlsm 中的某些内容存在问题。您想要...”吗? - How to fix error while opening Excel using Apache POI. Error say "We found a problem with some content in xyz.xlsm. Do you want..."? 在 Windows 中打开 Mac Office 365 Excel 文件 - “我们发现某些内容存在问题” - Open Mac Office 365 Excel File in Windows - 'we found a problem with some content' 在Excel中使用SXSSFWorkbook创建的打开文件:“找不到可读内容” - Opening File Created with SXSSFWorkbook in Excel: “Unreadable Content Found” Excel POI:“我们发现某些内容存在问题...”当Excel的行数少于135行时 - Excel POI: “We found a problem with some content in … ” when the Excel has less than 135 Rows Jasper生成Excel文件错误“ Excel在..中发现了不可读的内容” - Jasper generated Excel file error “Excel found unreadable content in .. ” Openpyxl:我们发现一些内容有问题 - Openpyxl: We found a problem with some content EPPlus Excel文件打开错误 - EPPlus Excel file Opening error Excel“找到不可读的内容”错误打开从C#创建的xlsx - Excel “found unreadable content” error opening a xlsx created from C#
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM