Excel.Application oXL = new Excel.Application();

            oXL.Visible 
= true;
            Excel._Workbook output_Xl
=(Excel._Workbook)oXL.Workbooks.Open(@"f:\date.xls",
                Missing.Value,
                Missing.Value,
                Missing.Value,
                Missing.Value,
                Missing.Value,
                Missing.Value,
                Missing.Value,
                Missing.Value,
                Missing.Value,
                Missing.Value,
                Missing.Value,
                Missing.Value,
                Missing.Value,
                Missing.Value
                );
            Excel._Workbook input_Xl 
= (Excel._Workbook)oXL.Workbooks.Open(@"f:\test.xls",
                Missing.Value,
                Missing.Value,
                Missing.Value,
                Missing.Value,
                Missing.Value,
                Missing.Value,
                Missing.Value,
                Missing.Value,
                Missing.Value,
                Missing.Value,
                Missing.Value,
                Missing.Value,
                Missing.Value,
                Missing.Value                
                );
            Excel.Worksheet input_sheet 
= (Excel.Worksheet)input_Xl.ActiveSheet;
            Excel.Worksheet output_sheet 
= (Excel.Worksheet)output_Xl.Sheets[1];
            Excel.Range input_Rng 
= input_sheet.get_Range("B2""C" + input_sheet.UsedRange.Rows.Count.ToString());
            Excel.Range output_Rng 
= output_sheet.get_Range("A2", Missing.Value);

            Excel.Range rng1 
= input_sheet.get_Range("B2", Missing.Value);
            Excel.Range rng2 
= input_sheet.get_Range("C2", Missing.Value);
            Excel.Range rng0 
= input_sheet.get_Range("A2", Missing.Value);

            DateTime[,] edt 
= new DateTime[input_sheet.UsedRange.Rows.Count, 2];
            TimeSpan[] ts 
= new TimeSpan[input_sheet.UsedRange.Rows.Count];

            
for (int i = 0; i < input_sheet.UsedRange.Rows.Count - 1; i++)
            
{
                edt[i, 
0= ConvertExcelDateToDate(rng1.Value2.ToString());
                edt[i, 
1= ConvertExcelDateToDate(rng2.Value2.ToString());

                ts[i] 
= edt[i, 1- edt[i, 0];

                
float start_X = (float)(((edt[i, 0].Day - 1* 30 + 50)/1.333);
                
float start_Y = (float)((i * 18 + 27)/1.333);
                
float end_X = (float)(((edt[i, 1].Day) * 30 + 50)/1.333);

                Excel.Shape line 
= output_sheet.Shapes.AddLine(start_X, start_Y, end_X, start_Y);// 1.333  侨既苞 inch券魂
                
                
//line style
                
//line.Line.BeginArrowheadStyle = Microsoft.Office.Core.MsoArrowheadStyle.msoArrowheadOval;
                
//line.Line.EndArrowheadStyle = Microsoft.Office.Core.MsoArrowheadStyle.msoArrowheadOpen;
                
//line.Line.DashStyle = Microsoft.Office.Core.MsoLineDashStyle.msoLineLongDash;
                line.Line.Weight = (float)1.5;
                
                output_Rng.Value2 
= rng0.Value2;
                
//
                Excel.Shape start_circle = output_sheet.Shapes.AddShape(Microsoft.Office.Core.MsoAutoShapeType.msoShapeOval, (float)(start_X-2/1.333), (float)(start_Y-1.6/1.333), (float)3, (float)3);
                Excel.Shape end_circle 
= output_sheet.Shapes.AddShape(Microsoft.Office.Core.MsoAutoShapeType.msoShapeOval, (float)(end_X-2/1.333), (float)(start_Y - 1.6 / 1.333), (float)3, (float)3);
               
// circle.Fill.Visible = Microsoft.Office.Core.MsoTriState.msoFalse;
                
                
//add top of line's Text
                Excel.Shape text = output_sheet.Shapes.AddTextbox(Microsoft.Office.Core.MsoTextOrientation.msoTextOrientationHorizontal,0,0,0,0);
                text.Line.Visible 
= Microsoft.Office.Core.MsoTriState.msoFalse;
                text.Fill.Visible 
= Microsoft.Office.Core.MsoTriState.msoFalse;
                text.TextFrame.Characters(Missing.Value, Missing.Value).Text 
= rng0.Value2.ToString();
                text.TextFrame.AutoSize 
= true;
                text.TextFrame.Characters(Missing.Value, Missing.Value).Font.Size 
= "7";

                text.Left 
= (float)(start_X + (end_X - start_X) / 2.0 - text.Width / 2.0);
                text.Top 
= (float)(start_Y - 10);

                
//add arc 
                
//Excel.Shape arc = DateSheet.Shapes.AddShape(Microsoft.Office.Core.MsoAutoShapeType.msoShapeArc, (float)20, (float)20, (float)20, (float)20);
                
//arc.Flip(Microsoft.Office.Core.MsoFlipCmd.msoFlipHorizontal);
                
//arc.Line.Style = Microsoft.Office.Core.MsoLineStyle.msoLineStyleMixed;
                

                
//MessageBox.Show(ts[i].Days.ToString());
                
                rng1 
= rng1.get_Range("A2", Missing.Value);
                rng2 
= rng2.get_Range("A2", Missing.Value);
                rng0 
= rng0.get_Range("A2", Missing.Value);
                output_Rng 
= output_Rng.get_Range("A2", Missing.Value);
            }

            
//DateSheet.Shapes.SelectAll();

            
            output_sheet.SaveAs(
@"f:\date2.xls",
                Missing.Value,
                Missing.Value,
                Missing.Value,
                Missing.Value,
                Missing.Value,
                Missing.Value,
                Missing.Value,
                Missing.Value,
                Missing.Value
                );
            oXL.Quit();