小编Pim*_*m_D的帖子

.jar中的NoSuchFileException但不包含在Eclipse中

当我在Eclipse中编译并运行我的程序时,运行没有异常.但是当我将它导出到可运行的jar或普通jar时,它找不到我的设置文件.

我的道路是:

String path= "src/settings/settings.ini";
Run Code Online (Sandbox Code Playgroud)

在eclipse中它运行无例外,但在jar中,它会立即抛出异常.

怎么可能让jar像日食一样工作?

java eclipse jar embedded-resource nosuchfileexception

2
推荐指数
1
解决办法
711
查看次数

C#OpenXML图像位于中心

我正在尝试在文档的中心生成一个带有图像的DocX文档,但我已经尝试了几样但没有任何结果.图像显示但位于左上角.addImageToBody函数来自MS网站(http://msdn.microsoft.com/en-us/library/office/bb497430(v=office.15).aspx).我试过使用Horizo​​ntalPosition类(http://msdn.microsoft.com/en-us/library/documentformat.openxml.drawing.wordprocessing.horizo​​ntalposition(v=office.14).aspx)但是没有工作为了我.

添加图片和通话功能:

 MainDocumentPart mainPart = document.MainDocumentPart;

                ImagePart imagePart = mainPart.AddImagePart(ImagePartType.Png);


                using (FileStream stream = new FileStream(@"C:...\Logo.png", FileMode.Open))
                {
                    imagePart.FeedData(stream);

                }

                AddImageToBody(document, mainPart.GetIdOfPart(imagePart));
Run Code Online (Sandbox Code Playgroud)

和功能:

 private static void AddImageToBody(WordprocessingDocument wordDoc, string relationshipId)
    {
        int defX = 854;
        int defY = 350;
        int size = 3000;
        // Define the reference of the image.
        var element =
             new DocumentFormat.OpenXml.Wordprocessing.Drawing(
                 new DW.Inline(
                     new DW.Extent() { Cx = defX * size, Cy = defY * size },
                     new DW.EffectExtent()
                     {
                         LeftEdge = …
Run Code Online (Sandbox Code Playgroud)

c# wpf docx openxml

1
推荐指数
1
解决办法
2119
查看次数

标签 统计

c# ×1

docx ×1

eclipse ×1

embedded-resource ×1

jar ×1

java ×1

nosuchfileexception ×1

openxml ×1

wpf ×1