Click here to Skip to main content
15,882,163 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Excel Printed Area only publish to web page code in C# ?

C#
m_addin.Application.ActiveWorkbook.publishObject.Add("?");


I want to Publish the Active Sheet Only to Web Page?
code in C#
can any one help me ?
Posted
Updated 12-Sep-21 11:56am
v4

 
Share this answer
 
Comments
Prasad_Kulkarni 19-Jul-12 4:49am    
My 5!
 
Share this answer
 
C#
string sel = "";
Excel.Worksheet worksheet1 = (Excel.Worksheet)m_AddIn.Application.ActiveSheet;
Excel.Range newRange = Globals.ThisAddIn.Application.Selection as Excel.Range;
string saveandpath = Path.ToString() + "\\" + "index" + ".htm";
sel = newRange.Cells.Address[External: true];
Excel.PublishObject publt = Globals.ThisAddIn.Application.ActiveWorkbook.PublishObjects.Add(Excel.XlSourceType.xlSourceRange,saveandpath, worksheet1.Name, sel, Excel.XlHtmlType.xlHtmlStatic) as Excel.PublishObject;
publt.Publish(true);
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900