public static void DrawTransform(float3 position, quaternion rotation, float scale) { Debug.DrawLine(position, position + Missing.xaxis(rotation) * scale, Color.red); Debug.DrawLine(position, position + Missing.yaxis(rotation) * scale, Color.green); Debug.DrawLine(position, position + Missing.zaxis(rotation) * scale, Color.blue); }
public int Execute(IQuestion <int, Missing> question, Missing parameter, IDefinition definition, Context context) { return(TheAnswer); }
public int ClampedTimeInSecondsToIndex(float timeInSeconds) { int frameIndex = Missing.roundToInt(timeInSeconds * SampleRate); return(math.clamp(frameIndex, 0, NumFrames - 1)); }
public override float3 Center(float3 position) { return(position + Missing.Convert(collider.center)); }
public int Evaluate(Missing parameter) { return(this.NumberOfFruits); }
public HasOptionalConstructorParameter([Import(AllowDefault = true)] Missing missing, Supplied supplied) { Missing = missing; Supplied = supplied; }
internal void Update(AffineTransform worldRootTransform, AffineTransform deltaTransform, float deltaTime) { NativeSlice <AffineTransform> trajectory = Array; int trajectoryLength = TrajectoryLength; int halfTrajectoryLength = trajectoryLength / 2; // // Since the trajectory is relative to the world root transform // and the synthesizer is adding 'deltaTransform' we need // to account for this by inverse transforming the // character space trajectory transforms. // var inverseQ = math.normalize( Missing.conjugate(deltaTransform.q)); for (int i = halfTrajectoryLength; i < trajectoryLength; ++i) { var transform = trajectory[i]; transform.t = Missing.rotateVector( inverseQ, transform.t); transform.q = math.normalize( math.mul(inverseQ, transform.q)); trajectory[i] = transform; } // // Update past trajectory // for (int i = deltaSpaceTrajectory.Length - 1; i > 0; --i) { deltaSpaceTrajectory[i] = deltaSpaceTrajectory[i - 1]; } var accumulatedTransform = deltaSpaceTrajectory[1].transform * deltaTransform; accumulatedTransform.q = math.normalize(accumulatedTransform.q); deltaSpaceTrajectory[0] = AccumulatedTransform.Create( accumulatedTransform, deltaTime); var referenceTransform = deltaSpaceTrajectory[0].transform; float sampleTimeInSeconds = 0.0f; float inverseSampleRate = Missing.recip(Binary.SampleRate); int numTransforms = deltaSpaceTrajectory.Length; var sampler = SubSampler.Create(); for (int i = halfTrajectoryLength - 1; i >= 0; --i) { sampleTimeInSeconds += inverseSampleRate; var deltaTransformAtSampleRate = sampler.SampleAt(deltaSpaceTrajectory, sampleTimeInSeconds); trajectory[i] = referenceTransform.inverseTimes( deltaTransformAtSampleRate); } }
internal void Append(string fieldname, DataTypeEnum dataTypeEnum, int length, FieldAttributeEnum adFldIsNullable, Missing value) { throw new NotImplementedException(); }
public Optional(Missing _) { this.value = default; IsMissing = true; }
protected override List <ChangedInfoBO> GetCoreChanges() => GetCoreChangeInfosOfComposed(Increased.SelectMany(x => x.Keys).ToList(), Missing.SelectMany(x => x.Keys).ToList(), x => x.Name);
protected override List <ChangedInfoBO> GetCoreChanges() => GetCoreChangeInfosOfComposed(Increased.ToList(), Missing.ToList(), x => x.Key);
public void CreateExportFile(List <Führer> führer, List <Führung> führung, string klasse, string path) { try { Missing misValue = Missing.Value; Microsoft.Office.Interop.Excel.Application xlApp = new Microsoft.Office.Interop.Excel.Application(); Workbook xlWorkBook = xlApp.Workbooks.Add(misValue); Worksheet xlWorkSheet = (Worksheet)xlWorkBook.Worksheets.get_Item(1); xlWorkSheet.PageSetup.LeftHeader = "09.11.2019"; //Methods.GetDate(); xlWorkSheet.PageSetup.CenterHeader = "TdoT - Auswertung"; xlWorkSheet.PageSetup.RightHeader = klasse + " [" + Methods.FindAbteilung(klasse) + "]"; xlWorkSheet.PageSetup.LeftMargin = 0.6D; xlWorkSheet.PageSetup.RightMargin = 0.6D; xlWorkSheet.PageSetup.BottomMargin = 1.9D; xlWorkSheet.PageSetup.CenterHorizontally = true; xlWorkSheet.PageSetup.AlignMarginsHeaderFooter = true; xlWorkSheet.Name = "TdoT"; xlWorkSheet.Cells[1, 1] = "Nachname"; xlWorkSheet.Cells[1, 2] = "Vorname"; xlWorkSheet.Cells[1, 3] = "Anwesenheit"; xlWorkSheet.Cells[1, 4] = "Führungen / Startzeit"; xlWorkSheet.Cells[1, 5] = "Dauer"; xlWorkSheet.get_Range("A:A", Type.Missing).EntireColumn.ColumnWidth = 17.86D; xlWorkSheet.get_Range("B:B", Type.Missing).EntireColumn.ColumnWidth = 26.43D; xlWorkSheet.get_Range("C:C", Type.Missing).EntireColumn.ColumnWidth = 13.57D; xlWorkSheet.get_Range("D:D", Type.Missing).EntireColumn.ColumnWidth = 20.86D; xlWorkSheet.get_Range("E:E", Type.Missing).EntireColumn.ColumnWidth = 12.71D; xlWorkSheet.get_Range("A1:E1", Type.Missing).EntireRow.RowHeight = 24; xlWorkSheet.get_Range("A1:E1", Type.Missing).Cells.Font.Bold = true; xlWorkSheet.get_Range("A1:E1", Type.Missing).Cells.VerticalAlignment = XlHAlign.xlHAlignCenter; xlWorkSheet.get_Range("A1:E1", Type.Missing).Cells.HorizontalAlignment = XlHAlign.xlHAlignCenter; xlWorkSheet.get_Range("A1:E1", Type.Missing).Interior.Color = ColorTranslator.ToOle(Color.FromArgb(221, 235, 247)); int zeile = 1; foreach (Führer p in führer) { zeile++; List <Führung> tempführungen = p.Führungen > 0 ? führung.Where(x => x.Uuid.Equals(p.Uuid)).ToList() : new List <Führung>(); xlWorkSheet.Cells[zeile, 1] = p.Nachname; xlWorkSheet.Cells[zeile, 2] = p.Vorname; xlWorkSheet.Cells[zeile, 3] = p.Anwesenheit ? "Ja" + (p.Notiz.Contains("Fertig") ? " / Abgemeldet" : "") : "Nein"; xlWorkSheet.Cells[zeile, 4] = p.Führungen; xlWorkSheet.Cells[zeile, 5] = tempführungen == new List <Führung>() ? "00:00:00" : Methods.FormatTime(new DateTime(tempführungen.Where(x => x.Ende != new DateTime()).Sum(x => ((x.Ende) - x.Start).Ticks))); xlWorkSheet.get_Range($"A{zeile}:E{zeile}", Type.Missing).EntireRow.RowHeight = 18; xlWorkSheet.get_Range($"A{zeile}:E{zeile}", Type.Missing).Cells.VerticalAlignment = XlHAlign.xlHAlignCenter; xlWorkSheet.get_Range($"A{zeile}:B{zeile}", Type.Missing).Cells.HorizontalAlignment = XlHAlign.xlHAlignLeft; xlWorkSheet.get_Range($"C{zeile}:E{zeile}", Type.Missing).Cells.HorizontalAlignment = XlHAlign.xlHAlignCenter; xlWorkSheet.get_Range($"A{zeile}:E{zeile}", Type.Missing).Interior.Color = ColorTranslator.ToOle(Color.FromArgb(226, 239, 218)); foreach (Führung f in tempführungen) { zeile++; xlWorkSheet.Cells[zeile, 4] = Methods.FormatTime(f.Start); xlWorkSheet.Cells[zeile, 5] = Methods.FormatTime(new DateTime(f.Ende != new DateTime() ? f.Ende.Subtract(f.Start).Ticks : DateTime.UtcNow.AddHours(1).Subtract(f.Start).Ticks)); xlWorkSheet.get_Range($"A{zeile}:E{zeile}", Type.Missing).EntireRow.RowHeight = 18; xlWorkSheet.get_Range($"A{zeile}:E{zeile}", Type.Missing).Cells.VerticalAlignment = XlHAlign.xlHAlignCenter; xlWorkSheet.get_Range($"A{zeile}:E{zeile}", Type.Missing).Cells.HorizontalAlignment = XlHAlign.xlHAlignCenter; xlWorkSheet.get_Range($"A{zeile}:E{zeile}", Type.Missing).Interior.Color = ColorTranslator.ToOle(Color.White); } } xlWorkBook.ExportAsFixedFormat(XlFixedFormatType.xlTypePDF, path, misValue, misValue, misValue, misValue, misValue, misValue, misValue); xlWorkBook = null; xlApp.Quit(); Marshal.ReleaseComObject(xlWorkSheet); Marshal.ReleaseComObject(xlApp); Process[] excelProcesses = Process.GetProcessesByName("excel"); foreach (Process p in excelProcesses) { if (string.IsNullOrEmpty(p.MainWindowTitle)) { p.Kill(); } } GC.SuppressFinalize(this); } catch (Exception) { MessageBox.Show("Fehler beim Erstellen der PDF", "Fehler!", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
// // Time related methods // /// <summary> /// Converts a time in seconds to an index. /// </summary> /// <param name="timeInSeconds">Time in seconds to be converted into an index.</param> /// <returns>Frame index that corresponds to the time in seconds passed as argument.</returns> public int TimeInSecondsToIndex(float timeInSeconds) { Assert.IsTrue(timeInSeconds >= 0.0f); return(Missing.truncToInt(timeInSeconds * SampleRate)); }
public override Contact this[int index] { get { var contact = Contact.Create( startPosition, float3.zero); contact.shape = null; Transform currentTransform = raycastHits[index].collider.transform; if (currentTransform == collider.transform) { return(contact); } while (currentTransform != null) { if (currentTransform == collider.transform) { return(contact); } currentTransform = currentTransform.parent; } contact.contact = raycastHits[index]; contact.contactOrigin = contact.startPosition; contact.contactCollider = raycastHits[index].collider; contact.contactPoint = raycastHits[index].point; contact.contactNormal = raycastHits[index].normal; contact.contactDistance = raycastHits[index].distance; if (raycastHits[index].distance == 0f) { var colliderPoint = ClosestPoint.FromPosition(contact.startPosition, contact.contactCollider, layerMask); if (Missing.IsNaN(colliderPoint)) { return(contact); } float3 delta = colliderPoint - contact.startPosition; if (math.abs(math.length(delta) - Radius) < epsilon) { float dot = math.dot(math.normalizesafe(delta), direction); if (dot <= -0.8f) { return(contact); } } contact.contactOrigin = contact.startPosition; contact.contactPoint = colliderPoint; contact.contactDistance = math.length(delta) - Radius; contact.contactPenetration = (contact.contactDistance < 0f); RaycastHit raycastHit; if (Raycast.ClosestHit(contact.startPosition, math.normalizesafe(delta), out raycastHit, Mathf.Max(contact.contactDistance + Radius, Radius + 0.01f))) { contact.contactNormal = raycastHit.normal; } else if (contact.contactDistance < epsilon) { contact.contactNormal = math.normalizesafe(contact.startPosition - colliderPoint); } } if (!Missing.equalEps(direction, -Missing.up, epsilon)) { RaycastHit raycastHit; if (Raycast.ClosestHit(contact.contactPoint - (direction * distance), direction, out raycastHit, distance + Radius, -1, collider.transform)) { contact.contactNormal = raycastHit.normal; } } contact.shape = this; return(contact); } }
public void OutPut2(DataTable dt) { bool isShowExcel = false; if (dt == null) { return; } if (dt.Rows.Count == 0) { //return; } Missing miss = Missing.Value; Microsoft.Office.Interop.Excel.Application xlApp = new Microsoft.Office.Interop.Excel.Application(); if (xlApp == null) { MessageBox.Show("请确保您的电脑已经安装Excel!", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } //xlApp.UserControl = true; Microsoft.Office.Interop.Excel.Workbooks workBooks = xlApp.Workbooks; Microsoft.Office.Interop.Excel.Workbook workBook = null; if (!File.Exists(base.m_TemplateFilePath)) { workBook = workBooks.Add(Microsoft.Office.Interop.Excel.XlWBATemplate.xlWBATWorksheet);//创建新的 } else { workBook = workBooks.Add(base.m_TemplateFilePath); //根据现有excel模板产生新的Workbook } Microsoft.Office.Interop.Excel.Worksheet workSheet = (Microsoft.Office.Interop.Excel.Worksheet)workBook.Worksheets[1]; //获取sheet1 xlApp.DisplayAlerts = false; //保存Excel的时候,不弹出是否保存的窗口直接进行保存 //workSheet.get_Range("A3", "B3").Merge(workSheet.get_Range("A3", "B3").MergeCells);//合并单元格 if (workSheet == null) { MessageBox.Show("请确保您的电脑已经安装Excel!", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } try { //Microsoft.Office.Interop.Excel.Range range = null; xlApp.Visible = isShowExcel;//若是true,则在导出的时候会显示excel界面 int totalCount = dt.Rows.Count; if (File.Exists(base.m_TemplateFilePath)) { for (int i = 0; i < dt.Rows.Count; i++) { for (int j = 0; j < dt.Columns.Count; j++) { for (int k = 0; k < workBook.Names.Count; k++) { if (workBook.Names.Item(dt.Columns[j].Caption) != null)//.Name == dt.Columns[j].Caption) { //定义第一个全局命名区域 int row = workBook.Names.Item(dt.Columns[j].Caption).RefersToRange.Row; int col = workBook.Names.Item(dt.Columns[j].Caption).RefersToRange.Column; workSheet.Cells[row + i + 1, col] = "'" + dt.Rows[i][j].ToString(); break; } } } } } else { if (MessageBox.Show("没有找到数据表格模板,是否按默认的格式导出?", "提示信息", MessageBoxButtons.YesNo, MessageBoxIcon.Information) == DialogResult.No) { return; } workSheet.Cells[1, 1] = dt.TableName;//导出标题 for (int j = 0; j < dt.Columns.Count; j++) { workSheet.Cells[4, j + 1] = dt.Columns[j].ColumnName; workBook.Names.Add(dt.Columns[j].ColumnName, workSheet.Cells[4, j + 1]);//, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing); //workBook.Names.Item(dt.Columns[j].ColumnName).RefersTo = workSheet.get_Range(workSheet.Cells[4, j + 1]); } Microsoft.Office.Interop.Excel.Range newExpenseTypeRange = workSheet.get_Range(workSheet.Cells[1, 1], workSheet.Cells[3, dt.Columns.Count]); newExpenseTypeRange.Merge(workSheet.get_Range(workSheet.Cells[1, 1], workSheet.Cells[3, dt.Columns.Count]).MergeCells);//合并单元格 newExpenseTypeRange.VerticalAlignment = Microsoft.Office.Interop.Excel.XlVAlign.xlVAlignCenter; newExpenseTypeRange.HorizontalAlignment = Microsoft.Office.Interop.Excel.XlVAlign.xlVAlignCenter; //写入数值 for (int i = 0; i < dt.Rows.Count; i++) { for (int j = 0; j < dt.Columns.Count; j++) { if (dt.Rows[i][j].GetType().Equals(typeof(DateTime))) { workSheet.Cells[i + 5, j + 1] = ((DateTime)(dt.Rows[i][j])).ToString("yyyy-MM-dd HH:mm:ss"); } else { workSheet.Cells[i + 5, j + 1] = dt.Rows[i][j];//项目序号 } } } WorkSheetPageSet(xlApp, workSheet); } string fileExt = DateTime.Now.ToString("yyyyMMddHHmmss"); string fileOutPut = base.m_OutputFilePath.Insert(m_OutputFilePath.LastIndexOf("."), fileExt); workBook.SaveAs(fileOutPut, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Microsoft.Office.Interop.Excel.XlSaveAsAccessMode.xlNoChange, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing); //workSheet.SaveAs(base.templateFilePath, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing); workBooks.Close(); if (MessageBox.Show("Excel导出成功:" + fileOutPut + "\r\n是否要打开?", "提示信息", MessageBoxButtons.YesNo, MessageBoxIcon.Information) == DialogResult.Yes) { System.Diagnostics.Process.Start(fileOutPut); } } catch (Exception ex) { MessageBox.Show("Excel导出失败,错误:" + ex.Message, "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Information); xlApp.Quit(); } finally { xlApp.Quit(); } }///// <summary>
private void DrawAnimationWidget(FrameDebugProviderInfo providerInfo, AnimationDebugRecord animStateRecord, int animIndex, TimelineWidget.DrawInfo drawInfo) { AnimationRecord animation = animStateRecord.AnimationRecords[animIndex]; if (animation.endTime < drawInfo.timeline.startTime) { return; } if (animation.startTime > drawInfo.timeline.endTime) { return; } float startPosition = drawInfo.GetPixelPosition(animation.startTime); float endPosition = drawInfo.GetPixelPosition(animation.endTime); Rect drawRect = drawInfo.timeline.drawRect; drawRect.y += animation.rank * kAnimWidgetOffset; Rect animRect = new Rect(startPosition, drawRect.y, endPosition - startPosition, kAnimWidgetHeight); TimelineWidget.DrawRectangleWithDetour(animRect, kAnimWidgetBackgroundColor, kAnimWidgetDetourColor); int barStartPosition = Missing.truncToInt(startPosition) + 1; int maxBarPosition = Missing.truncToInt(endPosition); for (int i = 0; i < animation.animFrames.Count; ++i) { int barEndPosition = Missing.truncToInt(drawInfo.GetPixelPosition(animation.animFrames[i].endTime)); if (barEndPosition > barStartPosition) { float weight = animation.animFrames[i].weight; if (weight < 1.0f) { Rect barRect = new Rect(barStartPosition, drawRect.y, barEndPosition - barStartPosition, (1.0f - weight) * kAnimWidgetHeight); TimelineWidget.DrawRectangle(barRect, kAnimWidgetWeightColor); } } barStartPosition = barEndPosition; } TimelineWidget.DrawLabelInsideRectangle(animRect, animation.animName, kAnimWidgetTextColor); // check if mouse is hovering the anim widget if (endPosition > startPosition && animRect.Contains(Event.current.mousePosition)) { float mouseNormalizedTime = (Event.current.mousePosition.x - startPosition) / (endPosition - startPosition); float mouseTime = animation.startTime + mouseNormalizedTime * (animation.endTime - animation.startTime); float curStartTime = animation.startTime; for (int i = 0; i < animation.animFrames.Count; ++i) { float curEndTime = animation.animFrames[i].endTime; if (curStartTime <= mouseTime && mouseTime <= curEndTime) { m_SelectedAnimFrame.providerIdentifier = providerInfo.uniqueIdentifier; m_SelectedAnimFrame.animIndex = animIndex; m_SelectedAnimFrame.animFrameIndex = i; m_SelectedAnimFrame.mouseX = Missing.truncToInt(Event.current.mousePosition.x); return; } curStartTime = curEndTime; } } }
public DataTable InPut2(string tableName, string filePath) { bool isShowExcel = false; DataTable dataTableResult = null; Missing miss = Missing.Value; Microsoft.Office.Interop.Excel.Application xlApp = new Microsoft.Office.Interop.Excel.Application(); if (xlApp == null) { MessageBox.Show("请确保您的电脑已经安装Excel!", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Information); return(null); } //xlApp.UserControl = true; Microsoft.Office.Interop.Excel.Workbooks workBooks = xlApp.Workbooks; Microsoft.Office.Interop.Excel.Workbook workBook = null; if (!File.Exists(filePath)) { MessageBox.Show("未找到数据表格导:\r\n\"" + base.m_TemplateFilePath + "\"", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Information); return(null); } else { workBook = workBooks.Add(filePath); //根据现有excel模板产生新的Workbook } Microsoft.Office.Interop.Excel.Worksheet workSheet = (Microsoft.Office.Interop.Excel.Worksheet)workBook.Worksheets[1]; //获取sheet1 xlApp.DisplayAlerts = false; //保存Excel的时候,不弹出是否保存的窗口直接进行保存 if (workSheet == null) { MessageBox.Show("请确保您的电脑已经安装Excel!", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Information); return(null); } try { xlApp.Visible = isShowExcel; dataTableResult = new DataTable(tableName); int rowIndexStart = 0; for (int k = 1; k < workBook.Names.Count + 1; k++) { if (!dataTableResult.Columns.Contains(workBook.Names.Item(k).Name)) { dataTableResult.Columns.Add(workBook.Names.Item(k).Name); } rowIndexStart = workBook.Names.Item(k).RefersToRange.Row; } for (int i = rowIndexStart + 1; i < workSheet.UsedRange.Rows.Count + 1; i++) { DataRow newRow = dataTableResult.NewRow(); for (int k = 1; k < workBook.Names.Count + 1; k++) { if (!dataTableResult.Columns.Contains(workBook.Names.Item(k).Name)) { dataTableResult.Columns.Add(workBook.Names.Item(k).Name); } //定义第一个全局命名区域 int row = workBook.Names.Item(k).RefersToRange.Row; int col = workBook.Names.Item(k).RefersToRange.Column; //newRow[k-1] = workSheet.Cells[row + i + 1, col].ToString(); var value = workSheet.get_Range(workSheet.Cells[i, col], workSheet.Cells[i, col]).Value; if (value == null) { value = workSheet.get_Range(workSheet.Cells[i, col], workSheet.Cells[i, col]).Value2; } if (value != null) { if (value.GetType().Equals(typeof(DateTime))) { newRow[k - 1] = ((DateTime)value).ToString("yyyy-MM-dd HH:mm:ss"); } else { newRow[k - 1] = Convert.ToString(value); } } } dataTableResult.Rows.Add(newRow); } } catch (Exception ex) { MessageBox.Show("Excel导入失败,错误:" + ex.Message, "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Information); xlApp.Quit(); } finally { xlApp.Quit(); } return(dataTableResult); }
public static void ExportDataToExcel() { if (ExportDataTable.Rows.Count == 0) { MessageBox.Show("没有数据可供导出!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); } else { saveFileDialog.Filter = "Execl files (*.xls)|*.xls"; saveFileDialog.FilterIndex = 0; saveFileDialog.RestoreDirectory = true; saveFileDialog.CreatePrompt = true; saveFileDialog.FileName = "车辆信息-" + DateTime.Now.ToString("yyyy-MM-dd"); saveFileDialog.Title = "导出文件保存路径"; string fileName = ""; if (saveFileDialog.ShowDialog() == DialogResult.OK) { fileName = saveFileDialog.FileName; if (!string.IsNullOrEmpty(fileName)) { int num = 1; int num2 = 3; Missing fileFormat = Missing.Value; ApplicationClass o = new ApplicationClass(); o.Visible = false; if (o == null) { MessageBox.Show("EXCEL无法启动!", "错误", MessageBoxButtons.OK, MessageBoxIcon.Hand); } else { Workbook workbook = o.Workbooks.Add(1); Worksheet worksheet = (Worksheet)workbook.Worksheets[1]; if (gridView.Tag != null) { worksheet.Name = gridView.Tag.ToString(); } else { worksheet.Name = "车辆信息" + DateTime.Now.ToString("yyyy-MM-dd-01"); } for (int i = 0; i < ExportDataTable.Columns.Count; i++) { worksheet.Cells[num2 + 1, (num + i) + 1] = ExportDataTable.Columns[i].Caption.ToString(); } for (int j = 0; j < ExportDataTable.Rows.Count; j++) { for (int k = 0; k < ExportDataTable.Columns.Count; k++) { worksheet.Cells[(num2 + j) + 2, (num + k) + 1] = "'" + ExportDataTable.Rows[j][k].ToString(); } } worksheet.Columns.EntireColumn.AutoFit(); worksheet.SaveAs(fileName, fileFormat, fileFormat, fileFormat, fileFormat, fileFormat, XlSaveAsAccessMode.xlNoChange, fileFormat, fileFormat, fileFormat); workbook.Close(false, fileFormat, fileFormat); o.Quit(); Marshal.ReleaseComObject(worksheet); Marshal.ReleaseComObject(workbook); Marshal.ReleaseComObject(o); GC.Collect(); MessageBox.Show("数据已经成功导出到:" + saveFileDialog.FileName.ToString(), "导出完成", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); } } } } }
internal static int DurationToFrames(float durationInSeconds, float samplesPerSecond) { return(Missing.truncToInt( durationInSeconds * samplesPerSecond) + 1); }
public RuleResult CheckMethod(MethodDefinition method) { // rule doesn't apply if method has no IL if (!method.HasBody) { return(RuleResult.DoesNotApply); } // check if any instruction refers to methods or types that MoMA could track if (!mask.Intersect(OpCodeEngine.GetBitmask(method))) { return(RuleResult.DoesNotApply); } // rule applies foreach (Instruction ins in method.Body.Instructions) { // look for any instruction that could use something incomplete if (!mask.Get(ins.OpCode.Code)) { continue; } // filter calls to assemblies that MoMA likely does not include (e.g. your own code) MethodReference mr = (ins.Operand as MethodReference); if ((mr == null) || !Filter(mr.DeclaringType.Scope as AssemblyNameReference)) { continue; } // MethodReference.ToString is costly so we do it once for the three checks string callee = mr.GetFullName(); // calling not implemented method is very likely not to work == High if ((NotImplemented != null) && NotImplementedInternal.Contains(callee)) { string message = String.Format(CultureInfo.InvariantCulture, NotImplementedMessage, callee); // confidence is Normal since we can't be sure if MoMA data is up to date Runner.Report(method, ins, Severity.High, Confidence.Normal, message); } // calling missing methods can't work == Critical if ((Missing != null) && Missing.Contains(callee)) { string message = String.Format(CultureInfo.InvariantCulture, MissingMessage, callee); Runner.Report(method, ins, Severity.Critical, Confidence.Normal, message); } // calling todo methods migh work with some limitations == Medium if (ToDo != null) { string value; if (ToDo.TryGetValue(callee, out value)) { string message = String.Format(CultureInfo.InvariantCulture, TodoMessage, callee, value); Runner.Report(method, ins, Severity.Medium, Confidence.Normal, message); } } } return(Runner.CurrentRuleResult); }
/// <summary> /// Evaluates this instance. /// </summary> /// <param name="parameter">The parameter.</param> /// <returns>The result of the evaluation.</returns> public override TExpressionResult Evaluate(Missing parameter) { return(this.Evaluate()); }
public void Prep() { Instances = Instances.OrderBy(i => i.Port).ThenBy(i => i.Name).ThenBy(i => i.Host.HostName).ToList(); Masters = Instances.Where(i => i.IsMaster).ToList(); Slaving = Instances.Where(i => i.IsSlaving).ToList(); Missing = Instances.Where(i => !Slaving.Contains(i) && (i.Info == null || i.Role == RedisInfo.RedisInstanceRole.Unknown || !i.Info.LastPollSuccessful)).ToList(); // In the single server view, everything is top level Heads = View == RedisViews.Server ? Instances.ToList() : Masters.Where(m => m.SlaveCount > 0).ToList(); StandAloneMasters = View == RedisViews.Server ? new List <RedisInstance>() : Masters.Where(m => m.SlaveCount == 0 && !Missing.Contains(m)).ToList(); }
public override Contact this[int index] { get { var contact = Contact.Create( startPosition, endPosition); contact.shape = null; Transform currentTransform = raycastHits[index].collider.transform; while (currentTransform != null) { if (currentTransform == collider.transform) { return(contact); } currentTransform = currentTransform.parent; } contact.contact = raycastHits[index]; contact.contactCollider = raycastHits[index].collider; contact.contactPoint = raycastHits[index].point; contact.contactNormal = raycastHits[index].normal; contact.contactDistance = raycastHits[index].distance; if (raycastHits[index].distance == 0f) { var(linePoint, colliderPoint) = ClosestPoint.FromLineSegment( contact.startPosition, contact.endPosition, contact.contactCollider, layerMask); if (Missing.IsNaN(colliderPoint)) { return(contact); } var delta = colliderPoint - linePoint; contact.contactOrigin = linePoint; contact.contactPoint = colliderPoint; contact.contactDistance = math.length(delta) - Radius; contact.contactPenetration = (contact.contactDistance < 0f); RaycastHit raycastHit; if (Raycast.ClosestHit( linePoint, math.normalizesafe(delta), out raycastHit, math.max(contact.contactDistance + Radius, Radius + 0.01f))) { contact.contactNormal = raycastHit.normal; } else if (contact.contactDistance < epsilon) { contact.contactNormal = math.normalizesafe(linePoint - colliderPoint); } } else { contact.contactOrigin = ClosestPoint.FromPosition( contact.contactPoint, contact.startPosition, contact.endPosition); } contact.contactNormal = math.normalizesafe(contact.contactOrigin - contact.contactPoint); contact.shape = this; return(contact); } }
/// <summary> /// Run the diff operation. Until this is called, all lists will be empty /// </summary> /// <returns>true if anything is different between index, tree, and workdir</returns> private void UpdateDirectory(IEnumerable <string> paths, bool recursive) { RevWalk rw = new RevWalk(Repository); ObjectId id = Repository.Resolve(Constants.HEAD); var commit = id != null?rw.ParseCommit(id) : null; TreeWalk treeWalk = new TreeWalk(Repository); treeWalk.Reset(); treeWalk.Recursive = false; if (commit != null) { treeWalk.AddTree(commit.Tree); } else { treeWalk.AddTree(new EmptyTreeIterator()); } DirCache dc = Repository.ReadDirCache(); treeWalk.AddTree(new DirCacheIterator(dc)); FileTreeIterator workTree = new FileTreeIterator(Repository.WorkTree, Repository.FileSystem, WorkingTreeOptions.KEY.Parse(Repository.GetConfig())); treeWalk.AddTree(workTree); List <TreeFilter> filters = new List <TreeFilter> (); filters.Add(new SkipWorkTreeFilter(1)); var pathFilters = paths.Where(p => p != ".").Select(p => PathFilter.Create(p)).ToArray(); if (pathFilters.Length > 1) { filters.Add(OrTreeFilter.Create(pathFilters)); // Use an OR to join all path filters } else if (pathFilters.Length == 1) { filters.Add(pathFilters[0]); } if (filters.Count > 1) { treeWalk.Filter = AndTreeFilter.Create(filters); } else { treeWalk.Filter = filters[0]; } while (treeWalk.Next()) { AbstractTreeIterator treeIterator = treeWalk.GetTree <AbstractTreeIterator>(0); DirCacheIterator dirCacheIterator = treeWalk.GetTree <DirCacheIterator>(1); WorkingTreeIterator workingTreeIterator = treeWalk.GetTree <WorkingTreeIterator>(2); NGit.FileMode fileModeTree = treeWalk.GetFileMode(0); if (treeWalk.IsSubtree) { treeWalk.EnterSubtree(); continue; } int stage = dirCacheIterator != null?dirCacheIterator.GetDirCacheEntry().Stage : 0; if (stage > 1) { continue; } else if (stage == 1) { MergeConflict.Add(dirCacheIterator.EntryPathString); changesExist = true; continue; } if (treeIterator != null) { if (dirCacheIterator != null) { if (!treeIterator.EntryObjectId.Equals(dirCacheIterator.EntryObjectId)) { // in repo, in index, content diff => changed Modified.Add(dirCacheIterator.EntryPathString); changesExist = true; } } else { // in repo, not in index => removed if (!fileModeTree.Equals(NGit.FileMode.TYPE_TREE)) { Removed.Add(treeIterator.EntryPathString); changesExist = true; } } } else { if (dirCacheIterator != null) { // not in repo, in index => added Added.Add(dirCacheIterator.EntryPathString); changesExist = true; } else { // not in repo, not in index => untracked if (workingTreeIterator != null && !workingTreeIterator.IsEntryIgnored()) { Untracked.Add(workingTreeIterator.EntryPathString); changesExist = true; } } } if (dirCacheIterator != null) { if (workingTreeIterator == null) { // in index, not in workdir => missing Missing.Add(dirCacheIterator.EntryPathString); changesExist = true; } else { // Workaround to file time resolution issues long itime = dirCacheIterator.GetDirCacheEntry().LastModified; long ftime = workingTreeIterator.GetEntryLastModified(); if (itime / 1000 != ftime / 1000) { if (!dirCacheIterator.IdEqual(workingTreeIterator)) { // in index, in workdir, content differs => modified Modified.Add(dirCacheIterator.EntryPathString); changesExist = true; } } } } } }
internal static void GetUnitySerializationInfo(SerializationInfo info, Missing missing) { info.SetType(typeof(UnitySerializationHolder)); info.AddValue("UnityType", MissingUnity); }
public override void ReloadElements() { Profiler.BeginSample("MetricsTrack.ReloadElements"); Clear(); TargetAsset = m_Owner.TargetAsset; if (TargetAsset == null) { Profiler.EndSample(); return; } if (m_TaggedClip == null) { Profiler.EndSample(); return; } IntervalTree <MetricRange> intervalTree = BuildIntervalTree(m_TaggedClip); List <MetricRange> results = new List <MetricRange>(); intervalTree.IntersectsWithRange(0f, m_TaggedClip.DurationInSeconds, results); ProcessIntervalTreeResults(results); List <Segment> segments = ComputeSegments(m_TaggedClip, TargetAsset); int numBoundaryFrames = Missing.truncToInt(TargetAsset.TimeHorizon * TargetAsset.SampleRate); float boundaryDuration = numBoundaryFrames / TargetAsset.SampleRate; float prevSegmentDuration = 0.0f; if (m_TaggedClip.TaggedPreBoundaryClip != null) { List <Segment> prevSegments = ComputeSegments(m_TaggedClip.TaggedPreBoundaryClip, m_TargetAsset); if (prevSegments.Count > 0) { prevSegmentDuration = prevSegments[prevSegments.Count - 1].Duration; } } float nextSegmentDuration = 0.0f; if (m_TaggedClip.TaggedPostBoundaryClip != null) { List <Segment> nextSegments = ComputeSegments(m_TaggedClip.TaggedPostBoundaryClip, m_TargetAsset); if (nextSegments.Count > 0) { nextSegmentDuration = nextSegments[0].Duration; } } foreach (var metricRange in results) { Segment segment = Segment.Invalid; foreach (Segment s in segments) { if (s.DoesCoverInterval(metricRange)) { segment = s; break; } } Assert.IsTrue(segment.IsValid); if (!segment.IsValid) { continue; } segment.startTime += Mathf.Max(boundaryDuration - prevSegmentDuration, 0.0f); segment.endTime -= Mathf.Max(boundaryDuration - nextSegmentDuration, 0.0f); bool emptySegment = segment.FirstFrame >= segment.LastFrame; var metricElement = new MetricElement( metricRange.name, Mathf.Clamp(metricRange.intervalStart, 0.0f, m_TaggedClip.DurationInSeconds), Mathf.Clamp(metricRange.intervalEnd, 0.0f, m_TaggedClip.DurationInSeconds), segment.startTime, segment.endTime, emptySegment, this); AddElement(metricElement); if (!emptySegment) { // segment itself is long enough, but some included tags might be too short nonetheless. // we must warn the user in this case foreach (TagInterval tag in segment.tags) { int firstValidFrame = Mathf.Max(tag.firstFrame, segment.FirstFrame); int lastValidFrame = Mathf.Min(tag.lastFrame, segment.LastFrame); if (firstValidFrame >= lastValidFrame) { float startTime = segment.GetClipTimeFromFrameIndex(tag.firstFrame); float endTime = segment.GetClipTimeFromFrameIndex(tag.lastFrame); var tagTooShortElement = new MetricElement( "tag", startTime, endTime, startTime, endTime, true, this); AddElement(tagTooShortElement); } } } } ResizeContents(); Profiler.EndSample(); }
public IEnumerator BuildTransforms() { // // Now re-sample all animations according to the target // sample rate and adjust the segment information to // reference the transforms array. // // // Calculate total number of poses to be generated // (based on previously generated segments) // int numJoints = rig.NumJoints; if (numJoints < 2) { throw new ArgumentException($"Rig does not have enough joints. Only {numJoints} present."); } if (numFrames == 0) { throw new Exception("No animation frame to process, please make sure there is at least one single non-empty tag in your Kinematica asset."); } int numTransforms = numFrames * numJoints; using (NativeArray <AffineTransform> transforms = new NativeArray <AffineTransform>(numTransforms, Allocator.Persistent)) { int globalSegmentIndex = 0; int destinationFrameIndex = 0; for (int clipIndex = 0; clipIndex < clipSegments.Count; ++clipIndex) { ClipSegments segments = clipSegments[clipIndex]; AnimationClip clip = segments.Clip.GetOrLoadClipSync(); using (AnimationSampler animSampler = new AnimationSampler(rig, clip)) { float sourceSampleRate = clip.frameRate; float targetSampleRate = asset.SampleRate; float sampleRateRatio = sourceSampleRate / targetSampleRate; int numFrameResampledClip = (int)math.ceil(targetSampleRate * segments.Clip.DurationInSeconds); for (int segmentIndex = 0; segmentIndex < segments.NumSegments; ++segmentIndex, ++globalSegmentIndex) { Segment segment = segments[segmentIndex]; int firstFrame = Missing.roundToInt(segment.source.FirstFrame / sampleRateRatio); firstFrame = math.min(firstFrame, numFrameResampledClip - 1); SampleRange sampleRange = new SampleRange() { startFrameIndex = firstFrame, numFrames = segment.destination.NumFrames }; using (AnimationSampler.RangeSampler rangeSampler = animSampler.PrepareRangeSampler(asset.SampleRate, sampleRange, destinationFrameIndex, transforms)) { rangeSampler.Schedule(); progressFeedback?.Invoke(new ProgressInfo() { title = $"Sample clip {clip.name}", progress = (float)globalSegmentIndex / numSegments }); while (!rangeSampler.IsComplete) { yield return(null); if (bCancel) { rangeSampler.Complete(); yield break; } } rangeSampler.Complete(); } destinationFrameIndex += segment.destination.NumFrames; } } } WriteTransformsToBinary(transforms); } }
public void reportForm() { int rowCount = dataGridView1.Rows.Count; //获取dataGridView1的行数 int columnsCount = dataGridView1.Columns.Count; //获取dataGridView1的列数 //判断是否存在值 if (rowCount == 0) { MessageBox.Show("没有数据可供导出。。。", "Prompt", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } //定义个变量接收文件名字 string fileName = string.Empty; //new 一个对象用于提示用户选择保存文件位置 SaveFileDialog saveFileDialog = new SaveFileDialog(); saveFileDialog.Filter = "导出Excel (*.xls)|*.xls"; saveFileDialog.FilterIndex = 0; //筛选器的索引 saveFileDialog.RestoreDirectory = true; //对话框关闭前是否还原当前目录 saveFileDialog.CreatePrompt = true; //指定文件不存在,提示用户是否允许创建该文件 saveFileDialog.Title = "导出文件保存路径"; //设置对话框标题 //当前时间 DateTime now = DateTime.Now; saveFileDialog.FileName = now.Year.ToString().PadLeft(2) + now.Month.ToString().PadLeft(2, '0') + now.Day.ToString().PadLeft(2, '0') + "-" + now.Hour.ToString().PadLeft(2, '0') + now.Minute.ToString().PadLeft(2, '0') + now.Second.ToString().PadLeft(2, '0'); if (saveFileDialog.ShowDialog() == DialogResult.OK) { fileName = saveFileDialog.FileName; Missing miss = Missing.Value; Excel.Application excel = new Excel.Application(); excel.Application.Workbooks.Add(true); excel.Visible = false;//若是true,则在导出的时候会显示EXcel界面。 if (excel == null) { MessageBox.Show("Excel无法启动", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } Workbooks workbooks = excel.Workbooks; Workbook workbook = workbooks.Add(XlWBATemplate.xlWBATWorksheet); Worksheet worksheet = (Worksheet)workbook.Worksheets[1]; //取得sheet1 //写入标题 for (int i = 0; i < dataGridView1.ColumnCount; i++) { worksheet.Cells[1, i + 1] = dataGridView1.Columns[i].HeaderText; } #region 导出一页 ////写入数值 //for (int r = 0; r < dataGridView1.Rows.Count; r++) //{ // for (int i = 0; i < dataGridView1.ColumnCount; i++) // { // worksheet.Cells[r + 2, i + 1] = dataGridView1.Rows[r].Cells[i].Value; // } // System.Windows.Forms.Application.DoEvents(); //} #endregion ResultModelOfArrayOfModel_Waybill_Based4FqxSXX waybill = cs.GetWaybillList(waybillNumber, null, startTime, endTime, customerId, true, 3, true); if (waybill.Code != 0) { MessageBox.Show(waybill.Message); } else { //写入数值 for (int r = 0; r < waybill.Data.Length; r++) { //在字段前加单引号是为了防止自动转化格式,如057410007009导出后转化格式前面的0不会消失 worksheet.Cells[r + 2, 1] = "'" + waybill.Data[r].Numberk__BackingField; worksheet.Cells[r + 2, 2] = waybill.Data[r].ReceiverOrgk__BackingField; worksheet.Cells[r + 2, 3] = waybill.Data[r].ReceiverPersonk__BackingField; worksheet.Cells[r + 2, 4] = waybill.Data[r].ReceiverTelk__BackingField; worksheet.Cells[r + 2, 5] = waybill.Data[r].ReceiverAddressk__BackingField; worksheet.Cells[r + 2, 6] = waybill.Data[r].BeginAtk__BackingField; worksheet.Cells[r + 2, 7] = waybill.Data[r].BillingCountk__BackingField; System.Windows.Forms.Application.DoEvents(); } } worksheet.Columns.EntireColumn.AutoFit();//列宽自适应 if (fileName != "") { try { workbook.Saved = true; workbook.SaveCopyAs(fileName); } catch (Exception ex) { MessageBox.Show("导出文件时出错,文件可能正被打开!\n" + ex.Message); } } excel.Quit(); GC.Collect();//强行销毁 MessageBox.Show(fileName + "的简明资料保存成功", "提示", MessageBoxButtons.OK); } }
public int ClampedDurationInSecondsToFrames(float durationInSeconds) { int frameIndex = Missing.roundToInt(durationInSeconds * SampleRate); return(math.clamp(frameIndex, 0, NumFrames)); }
public static void CreateWordFile(string FileName) { Missing mis = System.Reflection.Missing.Value; Microsoft.Office.Interop.Word.ApplicationClass WordApp = new ApplicationClass(); Document WordDoc = WordApp.Documents.Add(mis, mis, mis, mis); DataTable TabDT = DBStructure.GetTables(); if (TabDT != null && TabDT.Rows.Count > 0) { Console.WriteLine("共计: " + TabDT.Rows.Count.ToString() + " 个表"); Console.WriteLine("序号\t\t表名\t\t表描述"); int j = 1; foreach (DataRow dr in TabDT.Rows) { string TabName = dr["name"].ToString().Trim(); string TabDescription = (dr["desctxt"] == DBNull.Value ? "" : dr["desctxt"].ToString().Trim()); DataTable ColsDT = DBStructure.GetTableInfo(TabName); if (ColsDT != null && ColsDT.Rows.Count > 0) { //移动焦点并换行 object count = 14; object WdLine = WdUnits.wdLine; //换一行; WordApp.Selection.MoveDown(WdLine, count, mis); //移动焦点 WordApp.Selection.TypeParagraph(); //插入段落 Table NewTab = WordDoc.Tables.Add(WordApp.Selection.Range, ColsDT.Rows.Count + 2, 7, mis, mis); NewTab.Borders.OutsideLineStyle = WdLineStyle.wdLineStyleSingle; NewTab.Borders.OutsideLineWidth = WdLineWidth.wdLineWidth025pt; WordApp.Selection.Cells.VerticalAlignment = WdCellVerticalAlignment.wdCellAlignVerticalCenter; WordApp.Selection.ParagraphFormat.Alignment = WdParagraphAlignment.wdAlignParagraphCenter; WordApp.Selection.Cells.Borders.OutsideLineStyle = WdLineStyle.wdLineStyleSingle; WordApp.Selection.Cells.Borders.OutsideLineWidth = WdLineWidth.wdLineWidth025pt; NewTab.Rows.AllowBreakAcrossPages = 0; NewTab.Rows.First.HeadingFormat = -1; NewTab.Rows.WrapAroundText = 0; NewTab.Cell(1, 1).Merge(NewTab.Cell(1, 7)); NewTab.Cell(1, 1).Range.Text = TabName + ":" + TabDescription; NewTab.Cell(1, 1).Range.Borders.OutsideLineStyle = WdLineStyle.wdLineStyleSingle; NewTab.Cell(1, 1).Range.Borders.OutsideLineWidth = WdLineWidth.wdLineWidth025pt; NewTab.Cell(2, 1).Range.Text = "列名"; NewTab.Cell(2, 1).Range.Borders.OutsideLineStyle = WdLineStyle.wdLineStyleSingle; NewTab.Cell(2, 1).Range.Borders.OutsideLineWidth = WdLineWidth.wdLineWidth025pt; NewTab.Cell(2, 2).Range.Text = "类型"; NewTab.Cell(2, 2).Range.Borders.OutsideLineStyle = WdLineStyle.wdLineStyleSingle; NewTab.Cell(2, 2).Range.Borders.OutsideLineWidth = WdLineWidth.wdLineWidth025pt; NewTab.Cell(2, 3).Range.Text = "长度"; NewTab.Cell(2, 3).Range.Borders.OutsideLineStyle = WdLineStyle.wdLineStyleSingle; NewTab.Cell(2, 3).Range.Borders.OutsideLineWidth = WdLineWidth.wdLineWidth025pt; NewTab.Cell(2, 4).Range.Text = "能否为空"; NewTab.Cell(2, 4).Range.Borders.OutsideLineStyle = WdLineStyle.wdLineStyleSingle; NewTab.Cell(2, 4).Range.Borders.OutsideLineWidth = WdLineWidth.wdLineWidth025pt; NewTab.Cell(2, 5).Range.Text = "是否自增"; NewTab.Cell(2, 5).Range.Borders.OutsideLineStyle = WdLineStyle.wdLineStyleSingle; NewTab.Cell(2, 5).Range.Borders.OutsideLineWidth = WdLineWidth.wdLineWidth025pt; NewTab.Cell(2, 6).Range.Text = "是否主键"; NewTab.Cell(2, 6).Range.Borders.OutsideLineStyle = WdLineStyle.wdLineStyleSingle; NewTab.Cell(2, 6).Range.Borders.OutsideLineWidth = WdLineWidth.wdLineWidth025pt; NewTab.Cell(2, 7).Range.Text = "描述"; NewTab.Cell(2, 7).Range.Borders.OutsideLineStyle = WdLineStyle.wdLineStyleSingle; NewTab.Cell(2, 7).Range.Borders.OutsideLineWidth = WdLineWidth.wdLineWidth025pt; int i = 3; foreach (DataRow subdr in ColsDT.Rows) { NewTab.Cell(i, 1).Range.Text = subdr["列名"].ToString(); NewTab.Cell(i, 1).Range.Borders.OutsideLineStyle = WdLineStyle.wdLineStyleSingle; NewTab.Cell(i, 1).Range.Borders.OutsideLineWidth = WdLineWidth.wdLineWidth025pt; NewTab.Cell(i, 2).Range.Text = subdr["类型"].ToString(); NewTab.Cell(i, 2).Range.Borders.OutsideLineStyle = WdLineStyle.wdLineStyleSingle; NewTab.Cell(i, 2).Range.Borders.OutsideLineWidth = WdLineWidth.wdLineWidth025pt; NewTab.Cell(i, 3).Range.Text = subdr["长度"].ToString(); NewTab.Cell(i, 3).Range.Borders.OutsideLineStyle = WdLineStyle.wdLineStyleSingle; NewTab.Cell(i, 3).Range.Borders.OutsideLineWidth = WdLineWidth.wdLineWidth025pt; NewTab.Cell(i, 4).Range.Text = subdr["能否为空"].ToString(); NewTab.Cell(i, 4).Range.Borders.OutsideLineStyle = WdLineStyle.wdLineStyleSingle; NewTab.Cell(i, 4).Range.Borders.OutsideLineWidth = WdLineWidth.wdLineWidth025pt; NewTab.Cell(i, 5).Range.Text = subdr["是否自增"].ToString(); NewTab.Cell(i, 5).Range.Borders.OutsideLineStyle = WdLineStyle.wdLineStyleSingle; NewTab.Cell(i, 5).Range.Borders.OutsideLineWidth = WdLineWidth.wdLineWidth025pt; NewTab.Cell(i, 6).Range.Text = subdr["是否主键"].ToString(); NewTab.Cell(i, 6).Range.Borders.OutsideLineStyle = WdLineStyle.wdLineStyleSingle; NewTab.Cell(i, 6).Range.Borders.OutsideLineWidth = WdLineWidth.wdLineWidth025pt; NewTab.Cell(i, 7).Range.Text = subdr["描述"].ToString(); NewTab.Cell(i, 7).Range.Borders.OutsideLineStyle = WdLineStyle.wdLineStyleSingle; NewTab.Cell(i, 7).Range.Borders.OutsideLineWidth = WdLineWidth.wdLineWidth025pt; i++; } Console.WriteLine(string.Format("{0}\t\t{1}\t\t{2}", j, TabName, TabDescription)); j++; Object objUnit = WdUnits.wdStory; WordApp.Selection.EndKey(ref objUnit); } } } WordDoc.SaveAs(FileName, mis, mis, mis, mis, mis, mis, mis, mis, mis, mis, mis, mis, mis, mis, mis); WordDoc.Close(mis, mis, mis); WordApp.Quit(); System.Runtime.InteropServices.Marshal.ReleaseComObject(WordApp); GC.Collect(); }