TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Paul L
NA
5
1.1k
Switching zoom and view (page break preview) in VS C# 2008/O2003
Jun 26 2020 4:35 AM
I've tried quite a bit of things in the interop, some just don't show up in VS that they do in the interop docs. The customer has Office 2003. I got the excel filled in, but I want to make sure it's in PBP and zoomed is right. I have yet to get that to work after a number of tries. Maybe you can make more sense of what i'm trying to do here. I'm (relitively) new to c#, but have a but have done other programming in the past. Mainly PHP, some VB.net. There is still a lot of the basics of c# I simply don't get. Here is my code
String ExcelFile = Directory.GetCurrentDirectory() + "\\WORK ORDER 1 EXCEL.xls";
using
System.Text;
using
System.Xml;
using
System.Windows.Forms;
using
Excel = Microsoft.Office.Interop.Excel;
using
System.Reflection;
using
System.IO;
String ExcelFile = Directory.GetCurrentDirectory() +
"\\WORK ORDER 1 EXCEL.xls"
;
Excel.Application xlApp;
Excel._Workbook oWB;
Excel._Worksheet oSheet;
Excel.Range oRng;
Excel.Workbooks oWBS =
null
;
Excel.Sheets sheets =
null
;
xlApp =
new
Excel.Application();
xlApp.Visible =
true
;
oWB = xlApp.Workbooks.Open(ExcelFile, 0, 1, Type.Missing, Type.Missing,
Type.Missing, Type.Missing, Type.Missing, Type.Missing,
Type.Missing, Type.Missing, Type.Missing, Type.Missing,
Type.Missing, Type.Missing);
sheets = oWB.Sheets;
oSheet = (Excel._Worksheet)oWB.ActiveSheet;
////oSheet.ViewMode = ViewMode.Preview;
oRng = (Excel.Range)oSheet.Cells[2, 41];
oRng.Value2 =
"12345"
;
I was looking into windows.view
but it does not contain view
https://docs.microsoft.com/en-us/dotnet/api/microsoft.office.interop.excel.window.view?view=excel-pia#Microsoft_Office_Interop_Excel_Window_View
Maybe it's the version i'm using. VS 2008 /w interop for office 2003 (though other than the page break preview issuek has been working)
I remember using com objects with VB.net a few years back. Nothing complicated like this
thank you
Reply
Answers (
0
)
Image in Button not Visible at Runtime in WPF user control
what are LLMs in AI?