Click here to Skip to main content
15,886,110 members
Home / Discussions / C#
   

C#

 
Questioncreate word file Pin
Milind Panchal2-Mar-10 22:33
Milind Panchal2-Mar-10 22:33 
AnswerRe: create word file Pin
Eddy Vluggen2-Mar-10 23:41
professionalEddy Vluggen2-Mar-10 23:41 
QuestionUpdate Cell Value into Excel Cell like 2009.03 and it become 2009.3 Pin
pankaj.calm2-Mar-10 22:17
professionalpankaj.calm2-Mar-10 22:17 
QuestionRe: Update Cell Value into Excel Cell like 2009.03 and it become 2009.3 Pin
Eddy Vluggen3-Mar-10 0:55
professionalEddy Vluggen3-Mar-10 0:55 
AnswerRe: Update Cell Value into Excel Cell like 2009.03 and it become 2009.3 Pin
pankaj.calm3-Mar-10 0:59
professionalpankaj.calm3-Mar-10 0:59 
QuestionRe: Update Cell Value into Excel Cell like 2009.03 and it become 2009.3 Pin
Eddy Vluggen3-Mar-10 1:39
professionalEddy Vluggen3-Mar-10 1:39 
AnswerRe: Update Cell Value into Excel Cell like 2009.03 and it become 2009.3 Pin
pankaj.calm3-Mar-10 2:02
professionalpankaj.calm3-Mar-10 2:02 
GeneralRe: Update Cell Value into Excel Cell like 2009.03 and it become 2009.3 Pin
Eddy Vluggen3-Mar-10 3:03
professionalEddy Vluggen3-Mar-10 3:03 
I've created a test-sheet in Excel (2007) and succesfully changed the NumberFormat using an adapted version of your code;
C#
using XL = Microsoft.Office.Interop.Excel;

[...].
object oMissing = System.Reflection.Missing.Value;
XL.Application App = new XL.ApplicationClass();			
XL.Workbook WorkBook = App.Workbooks.Open("C:\\Book1.xlsx", 
	oMissing, oMissing, oMissing, oMissing, oMissing, oMissing,
	oMissing, oMissing, oMissing, oMissing, oMissing, oMissing, 
	oMissing, oMissing);
XL.Worksheet Sheet = (XL.Worksheet)WorkBook.Worksheets[1];
XL.Range thisRange = (XL.Range)(Sheet.Cells[1, 1]);
thisRange.NumberFormat = "yyyy.mm";
WorkBook.Save();
WorkBook.Close(false, oMissing, oMissing);
Some points to keep in mind;
  • You'll need the correct Office Interop assemblies
  • The value that you're formatting needs to be a "real" date. (Not a string that contains month & year)
Hope this helps Smile | :)
I are Troll Suspicious | :suss:

QuestionRemote administration Pin
kebedetesema2-Mar-10 22:10
kebedetesema2-Mar-10 22:10 
AnswerRe: Remote administration Pin
Eddy Vluggen2-Mar-10 23:51
professionalEddy Vluggen2-Mar-10 23:51 
GeneralRe: Remote administration Pin
kebedetesema3-Mar-10 1:56
kebedetesema3-Mar-10 1:56 
GeneralRe: Remote administration Pin
Eddy Vluggen3-Mar-10 2:09
professionalEddy Vluggen3-Mar-10 2:09 
GeneralRe: Remote administration Pin
kebedetesema3-Mar-10 3:38
kebedetesema3-Mar-10 3:38 
GeneralRe: Remote administration Pin
Eddy Vluggen3-Mar-10 5:09
professionalEddy Vluggen3-Mar-10 5:09 
GeneralRe: Remote administration Pin
kebedetesema3-Mar-10 19:34
kebedetesema3-Mar-10 19:34 
GeneralRe: Remote administration Pin
Eddy Vluggen4-Mar-10 4:09
professionalEddy Vluggen4-Mar-10 4:09 
QuestionRegrding Control Pin
Anil Kumar.Arvapalli2-Mar-10 22:07
Anil Kumar.Arvapalli2-Mar-10 22:07 
AnswerRe: Regrding Control Pin
Eddy Vluggen3-Mar-10 0:02
professionalEddy Vluggen3-Mar-10 0:02 
AnswerRe: Regrding Control Pin
Mirko19803-Mar-10 4:05
Mirko19803-Mar-10 4:05 
QuestionCreating ShortCut on Desktop. Pin
Anil Kumar.Arvapalli2-Mar-10 21:57
Anil Kumar.Arvapalli2-Mar-10 21:57 
QuestionCustom Busy Window. Pin
The_Collector2-Mar-10 21:30
The_Collector2-Mar-10 21:30 
AnswerRe: Custom Busy Window. Pin
The Man from U.N.C.L.E.2-Mar-10 22:37
The Man from U.N.C.L.E.2-Mar-10 22:37 
GeneralRe: Custom Busy Window. Pin
The_Collector3-Mar-10 14:32
The_Collector3-Mar-10 14:32 
GeneralRe: Custom Busy Window. Pin
The Man from U.N.C.L.E.3-Mar-10 22:43
The Man from U.N.C.L.E.3-Mar-10 22:43 
GeneralRe: Custom Busy Window. Pin
The Man from U.N.C.L.E.3-Mar-10 23:53
The Man from U.N.C.L.E.3-Mar-10 23:53 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.