C# Excel Interop - Suppress 'Publishing' dialog when invoking Worksheet.ExportAsFixedFormat
I am using Excel Interop to open an xlsx file and save that as a pdf document. Upon invoking the 'ExportAsFixedFileFormat' method a dialog titled "Publishing" is displayed to indicate the progress. How can I suppress or hide this dialog? I have seen a few similar questions on other forums without a satisfying solution, but hopefully someone has solved this since then.
Code:
Application application = new Application();
application.DisplayAlerts = false; // <- No effect
application.Visible = false; // <- No effect
application.ScreenUpdating = false; // <- No effect
application.UserControl = false; // <- No effect
application.Workbooks.Open(path, Type.Missing, true);
application.DisplayDocumentActionTaskPane = false; // <- No effect
application.Worksheets[1].ExportAsFixedFormat(XlFixedFormatType.xlTypePDF, path);
c# .net excel export interop
|
show 6 more comments
I am using Excel Interop to open an xlsx file and save that as a pdf document. Upon invoking the 'ExportAsFixedFileFormat' method a dialog titled "Publishing" is displayed to indicate the progress. How can I suppress or hide this dialog? I have seen a few similar questions on other forums without a satisfying solution, but hopefully someone has solved this since then.
Code:
Application application = new Application();
application.DisplayAlerts = false; // <- No effect
application.Visible = false; // <- No effect
application.ScreenUpdating = false; // <- No effect
application.UserControl = false; // <- No effect
application.Workbooks.Open(path, Type.Missing, true);
application.DisplayDocumentActionTaskPane = false; // <- No effect
application.Worksheets[1].ExportAsFixedFormat(XlFixedFormatType.xlTypePDF, path);
c# .net excel export interop
This Bounty might help noone. It seems to depend on OS and Excel-Version, since on my Machine (Win 10 + Office 2013) not a single dialog is popping
– lokusking
Aug 9 '16 at 20:10
You simply can't. These sort of progress dialogs appear when Excel senses that the operation in progress is going to take long time. Even if you save your workbookCTRL+S
and the destination is a network drive with slow network you will see a progress dialog. Its mostly because you either you are publishing alot of data or your system is resource strapped or you are publishing on a network drive which is slow or all of these.
– cyboashu
Aug 9 '16 at 22:29
3
Few overkill ways to do this are, using WinAPI to find this dialog and set visibility to hidden or if you are concerned with user cancelling this operation, then again use WinAPI to block keyboard mouse input during the publication.
– cyboashu
Aug 9 '16 at 22:31
When I run your code (excel 2016) it says "no printer is installed, etc.". It looks like 1) it depends heavily on Excel version, 2) it depends heavily on what's installed, and 3) it depends on 3rd parties. Maybe the window is a 3rd party one (printer of some sort), not stricly speaking an Excel one. Why can't you use SaveAs (+pdf) instead of Export?
– Simon Mourier
Aug 11 '16 at 6:19
1
Yes, I was notified. Thanks.
– Michael Brandon Morris
Aug 12 '16 at 13:39
|
show 6 more comments
I am using Excel Interop to open an xlsx file and save that as a pdf document. Upon invoking the 'ExportAsFixedFileFormat' method a dialog titled "Publishing" is displayed to indicate the progress. How can I suppress or hide this dialog? I have seen a few similar questions on other forums without a satisfying solution, but hopefully someone has solved this since then.
Code:
Application application = new Application();
application.DisplayAlerts = false; // <- No effect
application.Visible = false; // <- No effect
application.ScreenUpdating = false; // <- No effect
application.UserControl = false; // <- No effect
application.Workbooks.Open(path, Type.Missing, true);
application.DisplayDocumentActionTaskPane = false; // <- No effect
application.Worksheets[1].ExportAsFixedFormat(XlFixedFormatType.xlTypePDF, path);
c# .net excel export interop
I am using Excel Interop to open an xlsx file and save that as a pdf document. Upon invoking the 'ExportAsFixedFileFormat' method a dialog titled "Publishing" is displayed to indicate the progress. How can I suppress or hide this dialog? I have seen a few similar questions on other forums without a satisfying solution, but hopefully someone has solved this since then.
Code:
Application application = new Application();
application.DisplayAlerts = false; // <- No effect
application.Visible = false; // <- No effect
application.ScreenUpdating = false; // <- No effect
application.UserControl = false; // <- No effect
application.Workbooks.Open(path, Type.Missing, true);
application.DisplayDocumentActionTaskPane = false; // <- No effect
application.Worksheets[1].ExportAsFixedFormat(XlFixedFormatType.xlTypePDF, path);
c# .net excel export interop
c# .net excel export interop
edited Aug 11 '16 at 12:07
user6681160
asked Dec 1 '15 at 0:27
bjornno
12114
12114
This Bounty might help noone. It seems to depend on OS and Excel-Version, since on my Machine (Win 10 + Office 2013) not a single dialog is popping
– lokusking
Aug 9 '16 at 20:10
You simply can't. These sort of progress dialogs appear when Excel senses that the operation in progress is going to take long time. Even if you save your workbookCTRL+S
and the destination is a network drive with slow network you will see a progress dialog. Its mostly because you either you are publishing alot of data or your system is resource strapped or you are publishing on a network drive which is slow or all of these.
– cyboashu
Aug 9 '16 at 22:29
3
Few overkill ways to do this are, using WinAPI to find this dialog and set visibility to hidden or if you are concerned with user cancelling this operation, then again use WinAPI to block keyboard mouse input during the publication.
– cyboashu
Aug 9 '16 at 22:31
When I run your code (excel 2016) it says "no printer is installed, etc.". It looks like 1) it depends heavily on Excel version, 2) it depends heavily on what's installed, and 3) it depends on 3rd parties. Maybe the window is a 3rd party one (printer of some sort), not stricly speaking an Excel one. Why can't you use SaveAs (+pdf) instead of Export?
– Simon Mourier
Aug 11 '16 at 6:19
1
Yes, I was notified. Thanks.
– Michael Brandon Morris
Aug 12 '16 at 13:39
|
show 6 more comments
This Bounty might help noone. It seems to depend on OS and Excel-Version, since on my Machine (Win 10 + Office 2013) not a single dialog is popping
– lokusking
Aug 9 '16 at 20:10
You simply can't. These sort of progress dialogs appear when Excel senses that the operation in progress is going to take long time. Even if you save your workbookCTRL+S
and the destination is a network drive with slow network you will see a progress dialog. Its mostly because you either you are publishing alot of data or your system is resource strapped or you are publishing on a network drive which is slow or all of these.
– cyboashu
Aug 9 '16 at 22:29
3
Few overkill ways to do this are, using WinAPI to find this dialog and set visibility to hidden or if you are concerned with user cancelling this operation, then again use WinAPI to block keyboard mouse input during the publication.
– cyboashu
Aug 9 '16 at 22:31
When I run your code (excel 2016) it says "no printer is installed, etc.". It looks like 1) it depends heavily on Excel version, 2) it depends heavily on what's installed, and 3) it depends on 3rd parties. Maybe the window is a 3rd party one (printer of some sort), not stricly speaking an Excel one. Why can't you use SaveAs (+pdf) instead of Export?
– Simon Mourier
Aug 11 '16 at 6:19
1
Yes, I was notified. Thanks.
– Michael Brandon Morris
Aug 12 '16 at 13:39
This Bounty might help noone. It seems to depend on OS and Excel-Version, since on my Machine (Win 10 + Office 2013) not a single dialog is popping
– lokusking
Aug 9 '16 at 20:10
This Bounty might help noone. It seems to depend on OS and Excel-Version, since on my Machine (Win 10 + Office 2013) not a single dialog is popping
– lokusking
Aug 9 '16 at 20:10
You simply can't. These sort of progress dialogs appear when Excel senses that the operation in progress is going to take long time. Even if you save your workbook
CTRL+S
and the destination is a network drive with slow network you will see a progress dialog. Its mostly because you either you are publishing alot of data or your system is resource strapped or you are publishing on a network drive which is slow or all of these.– cyboashu
Aug 9 '16 at 22:29
You simply can't. These sort of progress dialogs appear when Excel senses that the operation in progress is going to take long time. Even if you save your workbook
CTRL+S
and the destination is a network drive with slow network you will see a progress dialog. Its mostly because you either you are publishing alot of data or your system is resource strapped or you are publishing on a network drive which is slow or all of these.– cyboashu
Aug 9 '16 at 22:29
3
3
Few overkill ways to do this are, using WinAPI to find this dialog and set visibility to hidden or if you are concerned with user cancelling this operation, then again use WinAPI to block keyboard mouse input during the publication.
– cyboashu
Aug 9 '16 at 22:31
Few overkill ways to do this are, using WinAPI to find this dialog and set visibility to hidden or if you are concerned with user cancelling this operation, then again use WinAPI to block keyboard mouse input during the publication.
– cyboashu
Aug 9 '16 at 22:31
When I run your code (excel 2016) it says "no printer is installed, etc.". It looks like 1) it depends heavily on Excel version, 2) it depends heavily on what's installed, and 3) it depends on 3rd parties. Maybe the window is a 3rd party one (printer of some sort), not stricly speaking an Excel one. Why can't you use SaveAs (+pdf) instead of Export?
– Simon Mourier
Aug 11 '16 at 6:19
When I run your code (excel 2016) it says "no printer is installed, etc.". It looks like 1) it depends heavily on Excel version, 2) it depends heavily on what's installed, and 3) it depends on 3rd parties. Maybe the window is a 3rd party one (printer of some sort), not stricly speaking an Excel one. Why can't you use SaveAs (+pdf) instead of Export?
– Simon Mourier
Aug 11 '16 at 6:19
1
1
Yes, I was notified. Thanks.
– Michael Brandon Morris
Aug 12 '16 at 13:39
Yes, I was notified. Thanks.
– Michael Brandon Morris
Aug 12 '16 at 13:39
|
show 6 more comments
4 Answers
4
active
oldest
votes
Perhaps I am not answering your question, but I'll try to be helpful. As far as I know, it's not recommended to use Excel Interop in back-end processing. You encountered one of its issues, but there are some others. There are 3rd party alternatives for interacting with Excel formats, some of them are open source and some are commercial. I would strongly recommend taking a look at one of them:
ClosedXML and NPOI. Both are open source and free.
add a comment |
How about processing it on a BackgroundWorker. This will not throw COMEXCEPTION
.
I tried this code on a button click and it works without displaying the progress dialog
.
var worker = new BackgroundWorker();
worker.DoWork += (o, args) =>
var path = @"D:sample.xlsx";
var application = new Microsoft.Office.Interop.Excel.Application();
application.Workbooks.Open(path,
Type.Missing, true);
application.Worksheets[1].ExportAsFixedFormat(XlFixedFormatType.xlTypePDF, path);
;
worker.RunWorkerAsync();
add a comment |
You can use pedamorf library ,pedamorf is a server that converts documents, images, urls, html and text to PDF. It relies heavily upon the excellent open-source programs wkhtml2pdf, Libre Office and iTextSharp. A client library is provided and can be used from a .NET application to utilize the conversion services provided by pedamorf.
More info is here
add a comment |
By far the better API to handle (create, read, export to PDF/html, etc...) XLS/XLSX files that I know is FlexCel. It's really simple, incredibly fast and full writen in C#. Don't require Excel instalation.
You'll find it here : http://www.tmssoftware.com/site/flexcelnet.asp (get the trial version with a lot of examples with source code)
If you have budget in your project to acquire the licence, I realy reccomend.
Use NuGet and search for EPPlus. It's by far (in my HO) the BEST API for generating with Excel content on the web.
– user3089358
Apr 4 '17 at 16:38
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f34010560%2fc-sharp-excel-interop-suppress-publishing-dialog-when-invoking-worksheet-exp%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
4 Answers
4
active
oldest
votes
4 Answers
4
active
oldest
votes
active
oldest
votes
active
oldest
votes
Perhaps I am not answering your question, but I'll try to be helpful. As far as I know, it's not recommended to use Excel Interop in back-end processing. You encountered one of its issues, but there are some others. There are 3rd party alternatives for interacting with Excel formats, some of them are open source and some are commercial. I would strongly recommend taking a look at one of them:
ClosedXML and NPOI. Both are open source and free.
add a comment |
Perhaps I am not answering your question, but I'll try to be helpful. As far as I know, it's not recommended to use Excel Interop in back-end processing. You encountered one of its issues, but there are some others. There are 3rd party alternatives for interacting with Excel formats, some of them are open source and some are commercial. I would strongly recommend taking a look at one of them:
ClosedXML and NPOI. Both are open source and free.
add a comment |
Perhaps I am not answering your question, but I'll try to be helpful. As far as I know, it's not recommended to use Excel Interop in back-end processing. You encountered one of its issues, but there are some others. There are 3rd party alternatives for interacting with Excel formats, some of them are open source and some are commercial. I would strongly recommend taking a look at one of them:
ClosedXML and NPOI. Both are open source and free.
Perhaps I am not answering your question, but I'll try to be helpful. As far as I know, it's not recommended to use Excel Interop in back-end processing. You encountered one of its issues, but there are some others. There are 3rd party alternatives for interacting with Excel formats, some of them are open source and some are commercial. I would strongly recommend taking a look at one of them:
ClosedXML and NPOI. Both are open source and free.
answered Sep 6 '16 at 6:58
Boris Modylevsky
2,0611635
2,0611635
add a comment |
add a comment |
How about processing it on a BackgroundWorker. This will not throw COMEXCEPTION
.
I tried this code on a button click and it works without displaying the progress dialog
.
var worker = new BackgroundWorker();
worker.DoWork += (o, args) =>
var path = @"D:sample.xlsx";
var application = new Microsoft.Office.Interop.Excel.Application();
application.Workbooks.Open(path,
Type.Missing, true);
application.Worksheets[1].ExportAsFixedFormat(XlFixedFormatType.xlTypePDF, path);
;
worker.RunWorkerAsync();
add a comment |
How about processing it on a BackgroundWorker. This will not throw COMEXCEPTION
.
I tried this code on a button click and it works without displaying the progress dialog
.
var worker = new BackgroundWorker();
worker.DoWork += (o, args) =>
var path = @"D:sample.xlsx";
var application = new Microsoft.Office.Interop.Excel.Application();
application.Workbooks.Open(path,
Type.Missing, true);
application.Worksheets[1].ExportAsFixedFormat(XlFixedFormatType.xlTypePDF, path);
;
worker.RunWorkerAsync();
add a comment |
How about processing it on a BackgroundWorker. This will not throw COMEXCEPTION
.
I tried this code on a button click and it works without displaying the progress dialog
.
var worker = new BackgroundWorker();
worker.DoWork += (o, args) =>
var path = @"D:sample.xlsx";
var application = new Microsoft.Office.Interop.Excel.Application();
application.Workbooks.Open(path,
Type.Missing, true);
application.Worksheets[1].ExportAsFixedFormat(XlFixedFormatType.xlTypePDF, path);
;
worker.RunWorkerAsync();
How about processing it on a BackgroundWorker. This will not throw COMEXCEPTION
.
I tried this code on a button click and it works without displaying the progress dialog
.
var worker = new BackgroundWorker();
worker.DoWork += (o, args) =>
var path = @"D:sample.xlsx";
var application = new Microsoft.Office.Interop.Excel.Application();
application.Workbooks.Open(path,
Type.Missing, true);
application.Worksheets[1].ExportAsFixedFormat(XlFixedFormatType.xlTypePDF, path);
;
worker.RunWorkerAsync();
edited Aug 16 '16 at 2:31
answered Aug 16 '16 at 2:25
jmvtrinidad
1,42111430
1,42111430
add a comment |
add a comment |
You can use pedamorf library ,pedamorf is a server that converts documents, images, urls, html and text to PDF. It relies heavily upon the excellent open-source programs wkhtml2pdf, Libre Office and iTextSharp. A client library is provided and can be used from a .NET application to utilize the conversion services provided by pedamorf.
More info is here
add a comment |
You can use pedamorf library ,pedamorf is a server that converts documents, images, urls, html and text to PDF. It relies heavily upon the excellent open-source programs wkhtml2pdf, Libre Office and iTextSharp. A client library is provided and can be used from a .NET application to utilize the conversion services provided by pedamorf.
More info is here
add a comment |
You can use pedamorf library ,pedamorf is a server that converts documents, images, urls, html and text to PDF. It relies heavily upon the excellent open-source programs wkhtml2pdf, Libre Office and iTextSharp. A client library is provided and can be used from a .NET application to utilize the conversion services provided by pedamorf.
More info is here
You can use pedamorf library ,pedamorf is a server that converts documents, images, urls, html and text to PDF. It relies heavily upon the excellent open-source programs wkhtml2pdf, Libre Office and iTextSharp. A client library is provided and can be used from a .NET application to utilize the conversion services provided by pedamorf.
More info is here
answered Dec 13 '16 at 13:04
Zuhaib Shah
86
86
add a comment |
add a comment |
By far the better API to handle (create, read, export to PDF/html, etc...) XLS/XLSX files that I know is FlexCel. It's really simple, incredibly fast and full writen in C#. Don't require Excel instalation.
You'll find it here : http://www.tmssoftware.com/site/flexcelnet.asp (get the trial version with a lot of examples with source code)
If you have budget in your project to acquire the licence, I realy reccomend.
Use NuGet and search for EPPlus. It's by far (in my HO) the BEST API for generating with Excel content on the web.
– user3089358
Apr 4 '17 at 16:38
add a comment |
By far the better API to handle (create, read, export to PDF/html, etc...) XLS/XLSX files that I know is FlexCel. It's really simple, incredibly fast and full writen in C#. Don't require Excel instalation.
You'll find it here : http://www.tmssoftware.com/site/flexcelnet.asp (get the trial version with a lot of examples with source code)
If you have budget in your project to acquire the licence, I realy reccomend.
Use NuGet and search for EPPlus. It's by far (in my HO) the BEST API for generating with Excel content on the web.
– user3089358
Apr 4 '17 at 16:38
add a comment |
By far the better API to handle (create, read, export to PDF/html, etc...) XLS/XLSX files that I know is FlexCel. It's really simple, incredibly fast and full writen in C#. Don't require Excel instalation.
You'll find it here : http://www.tmssoftware.com/site/flexcelnet.asp (get the trial version with a lot of examples with source code)
If you have budget in your project to acquire the licence, I realy reccomend.
By far the better API to handle (create, read, export to PDF/html, etc...) XLS/XLSX files that I know is FlexCel. It's really simple, incredibly fast and full writen in C#. Don't require Excel instalation.
You'll find it here : http://www.tmssoftware.com/site/flexcelnet.asp (get the trial version with a lot of examples with source code)
If you have budget in your project to acquire the licence, I realy reccomend.
answered Feb 10 '17 at 19:36
Haroldo Ribeiro Gomes
12
12
Use NuGet and search for EPPlus. It's by far (in my HO) the BEST API for generating with Excel content on the web.
– user3089358
Apr 4 '17 at 16:38
add a comment |
Use NuGet and search for EPPlus. It's by far (in my HO) the BEST API for generating with Excel content on the web.
– user3089358
Apr 4 '17 at 16:38
Use NuGet and search for EPPlus. It's by far (in my HO) the BEST API for generating with Excel content on the web.
– user3089358
Apr 4 '17 at 16:38
Use NuGet and search for EPPlus. It's by far (in my HO) the BEST API for generating with Excel content on the web.
– user3089358
Apr 4 '17 at 16:38
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f34010560%2fc-sharp-excel-interop-suppress-publishing-dialog-when-invoking-worksheet-exp%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
This Bounty might help noone. It seems to depend on OS and Excel-Version, since on my Machine (Win 10 + Office 2013) not a single dialog is popping
– lokusking
Aug 9 '16 at 20:10
You simply can't. These sort of progress dialogs appear when Excel senses that the operation in progress is going to take long time. Even if you save your workbook
CTRL+S
and the destination is a network drive with slow network you will see a progress dialog. Its mostly because you either you are publishing alot of data or your system is resource strapped or you are publishing on a network drive which is slow or all of these.– cyboashu
Aug 9 '16 at 22:29
3
Few overkill ways to do this are, using WinAPI to find this dialog and set visibility to hidden or if you are concerned with user cancelling this operation, then again use WinAPI to block keyboard mouse input during the publication.
– cyboashu
Aug 9 '16 at 22:31
When I run your code (excel 2016) it says "no printer is installed, etc.". It looks like 1) it depends heavily on Excel version, 2) it depends heavily on what's installed, and 3) it depends on 3rd parties. Maybe the window is a 3rd party one (printer of some sort), not stricly speaking an Excel one. Why can't you use SaveAs (+pdf) instead of Export?
– Simon Mourier
Aug 11 '16 at 6:19
1
Yes, I was notified. Thanks.
– Michael Brandon Morris
Aug 12 '16 at 13:39