Note that there are some explanatory texts on larger screens.

plurals
  1. POWord chart data updates in workbook but Word does not refresh the chart
    primarykey
    data
    text
    <p>I have a Word document (.docx) that has a series of charts. My code successfully updates the values behind a pie chart and Word appropriately displays the results (refreshes the front end of the chart, whatever you would like to call it).</p> <p>The same sadly cannot be said for a clustered bar chart. The values in the workbook update but the front end does not refresh to display the new values. </p> <p>Once I right click on the chart and select Edit Data (I do not even have to edit anything, just close the workbook window when it opens) it then refreshes the displayed values on the chart.</p> <p>Is there someway I can force a refresh of the front end without going through that? Closing the file and re-opening has no effect.</p> <p>What I have:</p> <pre><code>wordcon.Application wordapp = new wordcon.Application(); wordcon.Document docx = new wordcon.Document(); wordapp.ActiveDocument.InlineShapes[2].Chart.ChartData.Activate(); excelcon.Workbook excelwb = wordapp.ActiveDocument.InlineShapes[2].Chart.ChartData.Workbook; excelcon.Worksheet excelws = excelwb.Worksheets[1]; excelws.Cells[1, 2] = reference.top_issues_1_name; excelws.Cells[6, 1] = "a"; excelws.Cells[6, 2] = reference.top_issues_1; excelws.Cells[5, 1] = "b"; excelws.Cells[5, 2] = reference.top_issues_2; excelws.Cells[4, 1] = "c"; excelws.Cells[4, 2] = reference.top_issues_3; excelws.Cells[3, 1] = "d"; excelws.Cells[3, 2] = reference.top_issues_4; excelws.Cells[2, 1] = "e"; excelws.Cells[2, 2] = reference.top_issues_5; excelwb.Close(); Marshal.ReleaseComObject(excelws); Marshal.ReleaseComObject(excelwb); docx.SaveAs2(reference.chart_file_forked_path + reference.chart_file_forked_file_name); wordapp.Quit(); Marshal.ReleaseComObject(docx); Marshal.ReleaseComObject(wordapp); </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload