lk
2022-10-25 0dc33c313dd10437cd81659a4f8a98c8d5360147
解决了北太湖景区的问题上报功能的错误
2个文件已修改
32 ■■■■ 已修改文件
Libs/MojoCube.Api/File/WordHelper.cs 28 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Libs/MojoCube.Api/MojoCube.Api.csproj 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Libs/MojoCube.Api/File/WordHelper.cs
@@ -38,7 +38,7 @@
            {
                table.Columns[1].Width = Width - 4;
                //table.Columns[2].Width = Width * 2 + 6;
                table.Columns[2].Width = Titles.Length > 3 ? Width * 5-10  : Width * 8 + 12;
                table.Columns[2].Width = Titles.Length > 3 ? Width * 5 - 10 : Width * 8 + 12;
            }
            if (FontSize != 0)
            {
@@ -48,7 +48,7 @@
            return table;
        }
        public void GenerateInfos(string[] bookMarks, double[] bookInfos,ref WordHelper wordHelper)
        public void GenerateInfos(string[] bookMarks, double[] bookInfos, ref WordHelper wordHelper)
        {
            for (int i = 0; i < bookInfos.Length; i++)
            {
@@ -73,7 +73,7 @@
                return null;
        }
        public  List<Range> FindAll(Range range, string findText)
        public List<Range> FindAll(Range range, string findText)
        {
            int start = range.Start;
            int end = range.End;
@@ -96,15 +96,15 @@
            return ranges;
        }
        public void GenerateTables(System.Data.DataTable dt,string bookMark, ref WordHelper wordHelper)
        public void GenerateTables(System.Data.DataTable dt, string bookMark, ref WordHelper wordHelper)
        {
            string[] Titles = new string[dt.Columns.Count];
            for (int i = 0; i < dt.Columns.Count; i++)
            {
                if(i==0)continue;
                if (i == 0) continue;
                Titles[i] = dt.Columns[i].ColumnName;
            }
            Table table = wordHelper.AddTableTitles(Titles, bookMark, dt.Rows.Count+1, 30, 10,
            Table table = wordHelper.AddTableTitles(Titles, bookMark, dt.Rows.Count + 1, 30, 10,
                ref wordHelper);
            //填充非根节点
            for (int i = 0; i < dt.Rows.Count; i++)
@@ -112,20 +112,20 @@
                for (int j = 0; j < dt.Columns.Count; j++)
                {
                    //if (j >= 7) break;
                    if ((j == 2 || j==4) && dt.Rows[i][j].ToString()!="") //插入图片
                    if ((j == 2 || j == 4) && dt.Rows[i][j].ToString() != "") //插入图片
                    {
                        object range = table.Cell(i+2, j+1).Range;
                        string[] strImgs = dt.Rows[i][j].ToString().Split(new char[] {','});
                        object range = table.Cell(i + 2, j + 1).Range;
                        string[] strImgs = dt.Rows[i][j].ToString().Split(new char[] { ',' });
                        for (int m = 0; m < strImgs.Length; m++)
                        {
                             wordHelper.InsertPicture(range, System.Web.HttpContext.Current.Server.MapPath(strImgs[m]),70,50,1);
                            wordHelper.InsertPicture(range, System.Web.HttpContext.Current.Server.MapPath(strImgs[m]), 70, 50, 1);
                        }
                    }
                    else
                    {
                        wordHelper.InsertCell(table, i + 2, j+1, dt.Rows[i][j].ToString());
                        wordHelper.InsertCell(table, i + 2, j + 1, dt.Rows[i][j].ToString());
                    }
                }
            }
        }
@@ -146,7 +146,7 @@
            wordDoc = wordApp.Documents.Add(ref templateName, ref missing, ref missing, ref missing);
            wordDoc.SpellingChecked = false;//关闭拼写检查
            wordDoc.ShowSpellingErrors = false;
            //wordDoc = wordApp.Documents.Open(ref templateName, ref missing,
            //    ref missing, ref missing, ref missing, ref missing, ref missing,
            //    ref missing, ref missing, ref missing, ref missing, ref missing,
@@ -410,7 +410,7 @@
            wordDoc.Application.ActiveDocument.InlineShapes[1].Height = hight; //设置图片高度
        }
        public void InsertPicture(object range, string picturePath, float width, float hight,int no)
        public void InsertPicture(object range, string picturePath, float width, float hight, int no)
        {
            object linkToFile = false; //图片是否为外部链接
            object saveWithDocument = true; //图片是否随文档一起保存
Libs/MojoCube.Api/MojoCube.Api.csproj
@@ -27,6 +27,7 @@
    <WarningLevel>4</WarningLevel>
    <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
    <Prefer32Bit>false</Prefer32Bit>
    <PlatformTarget>AnyCPU</PlatformTarget>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
    <DebugType>pdbonly</DebugType>
@@ -136,11 +137,10 @@
  </ItemGroup>
  <ItemGroup>
    <ProjectReference Include="..\MojoCube.Office\MojoCube.Office.csproj">
      <Project>{3D1789E7-C69F-4355-8C7A-4FAE2C2E7774}</Project>
      <Project>{3d1789e7-c69f-4355-8c7a-4fae2c2e7774}</Project>
      <Name>MojoCube.Office</Name>
    </ProjectReference>
  </ItemGroup>
  <ItemGroup />
  <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
  <!-- To modify your build process, add your task inside one of the targets below and uncomment it. 
       Other similar extension points exist, see Microsoft.Common.targets.