java – Renderscript支持库的问题

我试图在API 16及更高版本的设备上使用 Android Renderscript支持库,按照步骤 described here.到目前为止,事情并不顺利.

我的Renderscript代码如下所示.

#pragma version(1)
#pragma rs java_package_name(com.xxx.renderscript.test)

#include "rs_time.rsh"

rs_script flipScript;
rs_allocation gIn;
rs_allocation gOut;
int width;
int height;
int direction = 0;

void root(uchar4 *v_out,const void *usrData,uint32_t x,uint32_t y) {
    if(direction == 0) { // flip horizontally
        const uchar4 *element = rsGetElementAt(gIn,width - x,y);
        float4 color = rsUnpackColor8888(*element);
        float4 output = {color.r,color.g,color.b};
        *v_out = rsPackColorTo8888(output);
    }
    else if(direction == 1) { // flip vertically
        const uchar4 *element = rsGetElementAt(gIn,x,height - y);
        float4 color = rsUnpackColor8888(*element);
        float4 output = {color.r,color.b};
        *v_out = rsPackColorTo8888(output);
    }
    else if(direction == 2) { // rotate left
        const uchar4 *element = rsGetElementAt(gIn,width - y,x);
        float4 color = rsUnpackColor8888(*element);
        float4 output = {color.r,color.b};
        *v_out = rsPackColorTo8888(output);
    }
    else if(direction == 3) { // rotate right
        const uchar4 *element = rsGetElementAt(gIn,y,height - x);
        float4 color = rsUnpackColor8888(*element);
        float4 output = {color.r,color.b};
        *v_out = rsPackColorTo8888(output);
    }
}

void flip(int testIdx) {
    int64_t  t0,t1;
    int64_t  t;
    t0 = rsUptimeNanos();
    rsForEach(flipScript,gIn,gOut);
    t1 = rsUptimeNanos();
    t = t1 - t0;
    rsDebug("  flip: timer on RS side: ",t);
}

首先我将我的Android SDK工具升级到22.3,将我的SDK平台工具升级到19.如果我单击ADT / Help / About ADT / Installation Details,我看到所有组件都已升级到22.3.0,除了Developer Tools,仍然是21.0.1:

Android DDMS  22.3.0.v201310242005-887826 com.android.ide.eclipse.ddms.feature.group  The Android Open Source Project
  Android Developer Tools   21.0.1.201212060302 com.android.ide.eclipse.adt.package.product null
  Android Development Tools 22.3.0.v201310242005-887826 com.android.ide.eclipse.adt.feature.group   The Android Open Source Project
  Android Hierarchy Viewer  22.3.0.v201310242005-887826 com.android.ide.eclipse.hierarchyviewer.feature.group   The Android Open Source Project
  Android Native Development Tools  22.3.0.v201310242005-887826 com.android.ide.eclipse.ndk.feature.group   The Android Open Source Project
  Android Traceview 22.3.0.v201310242005-887826 com.android.ide.eclipse.traceview.feature.group The Android Open Source Project
  Tracer for OpenGL ES  22.3.0.v201310242005-887826 com.android.ide.eclipse.gldebugger.feature.group    The Android Open Source Project

然后我按照上述步骤中的建议编辑了我的“project.properties”文件.我也做了修改,加入了Tim Murray的评论.

proguard.config=C:/android/adt-bundle-windows-x86_64/sdk/tools/proguard/proguard-android.txt:proguard-project.txt

# Project target.
target=android-18
renderscript.target=18
renderscript.support.mode=true
#sdk.buildtools=19.0.0

在我的Java代码中,我确保导入了支持库中的包.下面列出的是完整的Java文件:

package com.xxx.renderscript.test;

import android.support.v8.renderscript.*;
//import android.renderscript.RenderScript;
//import android.renderscript.Allocation;

import android.os.AsyncTask;
import android.os.Bundle;
import android.os.SystemClock;
import android.app.Activity;
import android.graphics.Bitmap;
import android.graphics.Bitmap.Config;
import android.graphics.BitmapFactory;
import android.graphics.Canvas;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
import android.util.Log;
import android.view.View;
import android.widget.ImageView;

public class RenderScriptTestActivity extends Activity {

    private final String mLog = this.getClass().getName();
    private static final int TESTS_PER_GROUP = 12;

    private Bitmap mBitmapIn;
    private Bitmap mBitmapOut;
    private ImageView mDisplayView;

    private RenderScript mRS = null;
    private ScriptC_flip mScriptFlip = null;
    private Allocation mInPixelsAllocation = null;
    private Allocation mOutPixelsAllocation = null;

    //use aSyncTask so we display the image while rendering it.
    private ImageRenderTask mImageRenderTask = null;
    private boolean isRsBenchDone = false;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        Log.i(mLog,"onCreate() ");
        super.onCreate(savedInstanceState);
        setContentView(R.layout.layout_rs);

        mBitmapIn = loadBitmap(R.drawable.city);
        mBitmapOut = loadBitmap(R.drawable.city);

        mDisplayView = (ImageView) findViewById(R.id.rs_display);
        mDisplayView.setImageBitmap(mBitmapOut);

        // RS instances
        mRS = RenderScript.create(this);
        mScriptFlip = new ScriptC_flip(mRS,getResources(),R.raw.flip);

        mInPixelsAllocation = Allocation.createFromBitmap(mRS,mBitmapIn,Allocation.MipmapControl.MIPMAP_NONE,Allocation.USAGE_SCRIPT);
        mOutPixelsAllocation = Allocation.createFromBitmap(mRS,mBitmapOut,Allocation.USAGE_SCRIPT);
    }

    @Override
    protected void onResume() {
        Log.i(mLog,"onResume ");
        super.onResume();

        // for thread & display control
        isRsBenchDone = true;
    }

    // initialize flip.rs
    private void setupRS() {
        Log.i(mLog,"Initializing flip.rs...");
        mScriptFlip.set_flipScript(mScriptFlip);
        mScriptFlip.set_width(mBitmapIn.getWidth());
        mScriptFlip.set_height(mBitmapIn.getHeight());
        mScriptFlip.set_gIn(mInPixelsAllocation);
        mScriptFlip.set_gOut(mOutPixelsAllocation);
    }

    @Override
    protected void onStop() {
        Log.i(mLog,"onStop ");
        super.onStop();
    }

    private void resetRS() {
        mBitmapIn  = null;
        mBitmapOut = null;
        mRS = null;
        mScriptFlip   = null;
        mInPixelsAllocation    = null;
        mOutPixelsAllocation   = null;
    }

    private Bitmap loadBitmap(int resource) {
        final BitmapFactory.Options options = new BitmapFactory.Options();
        options.inPreferredConfig = Bitmap.Config.ARGB_8888;
        Bitmap b_temp = BitmapFactory.decodeResource(getResources(),resource,options);
        int w = b_temp.getWidth();
        int h = b_temp.getHeight();
        Config cfg = b_temp.getConfig();
        Bitmap b_keep = Bitmap.createBitmap(w,h,cfg);
        Canvas c = new Canvas(b_keep);
        c.drawBitmap(b_temp,null);
        b_temp.recycle();

        if (true) {
            Log.d(mLog,"loadBitmap(): width = " + w + "  loadBitmap(): height = " + h);
        }
        return b_keep;
    }

    // press the button to invoke this function
    public void benchmark(View v) {
        if (false == isRsBenchDone) {  //do nothing if it's not done yet
            return;
        }
        if (mImageRenderTask != null) {
            if (mImageRenderTask.getStatus() == AsyncTask.Status.RUNNING) {
                return;
            }
            if (mImageRenderTask.getStatus() == AsyncTask.Status.PENDING) {
                mImageRenderTask.execute();
                return;
            }
        }
        // instantiate AsyncTask if not already existed & running
        Log.i(mLog,"User pressed Start");
        SystemClock.sleep(2000);
        isRsBenchDone = false;
        setupRS();
        mImageRenderTask = new ImageRenderTask();
        mImageRenderTask.execute();
    }

    // user presses this button when the test is done and all results have been
    // recorded.
    public void pressedRsExit(View view) {
        Log.i(mLog,"User pressed Exit");
        if (isRsBenchDone) {  // only exit when we are finished
            resetRS();
            RenderScriptTestActivity.this.finish();
        }
    }


    /**************************************************************************
     **
     *   Since the display must be updated in the main UI thread,and the main
     *   UI thread cannot be put to sleep,we have to use an AsyncTask to update
     *   the display after the image is rendered,and then sleep some time
     *   so that the tester can view the images being displayed.
     **
     **************************************************************************/
    private class ImageRenderTask extends AsyncTask<Void,Drawable,Void> {

        // runs in the UI (main) thread in correspondence to the AsyncTask
        // updating the drawable.
        protected void onProgressUpdate(Drawable... values) {
            Log.i(mLog,"onProgressUpdate...");
            super.onProgressUpdate(values);
            Drawable draw_tmp = values[0];
            mDisplayView.setImageDrawable(draw_tmp);
            mDisplayView.invalidate();
        }

        // runs on the UI (main) thread after the AsyncTask is finished
        @Override
        protected void onPostExecute(Void result) {
            super.onPostExecute(result);

            // reset the flag to exit
            isRsBenchDone = true;
        }

        @Override
        protected Void doInBackground(Void... params) {
            int group_id;
            int flip_way;

            //------------------------------------------------------------
            //                    group 4: flip horizontally
            //------------------------------------------------------------
            flip_way = 0;
            mScriptFlip.set_direction(flip_way);
            Log.i(mLog,"starting horizontal flipping ... ... ... ...");

            // measure group 4
            group_id = 4;  // used as a switch for render script
            measureRS(group_id);
            Log.i(mLog,"    horizontal done");

            // sleep cannot happen in the main UI thread
            SystemClock.sleep(2500);
            updateDisplay();
            SystemClock.sleep(2500);

            //------------------------------------------------------------
            //                    group 5: flip vertically
            //------------------------------------------------------------
            mScriptFlip.set_gIn(mInPixelsAllocation);
            flip_way = 1;
            mScriptFlip.set_direction(flip_way);
            Log.i(mLog,"starting vertical flipping ... ... ... ...");

            // measure group 5
            group_id = 5;  // used as a switch for render script
            measureRS(group_id);
            Log.i(mLog,"    vertical done");

            // sleep cannot happen in the main UI thread
            SystemClock.sleep(2500);
            updateDisplay();
            SystemClock.sleep(2500);

            return null;
        }

        // run and measure Render Script instances
        private void measureRS(int group_id) {
            if ((0==group_id) || (1 == group_id) || (2 == group_id)) {
                //other stuff
            }
            if (3 == group_id) {
                //other stuff
            }
            if ((4==group_id) || (5 == group_id)) {
                for (int i = 0; i < TESTS_PER_GROUP; i++) {
                    mScriptFlip.invoke_flip(i);
                }
            }
        }

        // update the displayed image
        private void updateDisplay() {
            Log.i(mLog,"updateDisplay...");
            //mOutPixelsAllocation.copyTo(mBitmapIn);  // this to verify the display.
            mOutPixelsAllocation.copyTo(mBitmapOut);
            Bitmap b_temp = Bitmap.createBitmap(mBitmapOut.getWidth(),mBitmapOut.getHeight(),Bitmap.Config.ARGB_8888);
            Canvas c_temp = new Canvas(b_temp);
            c_temp.drawBitmap(mBitmapOut,null);
            Drawable d_temp = new BitmapDrawable(getResources(),b_temp);
            publishProgress(d_temp);
        }
    }
}

最后,在我的项目属性中,我将外部JAR添加到Java Build Path中:

renderscript-v8.jar - C:\android\adt-bundle-windows-x86_64\sdk\build-tools\19.0.0\renderscript\lib

代码构建没有任何问题.然后我在几台设备上测试了它.以下是测试结果.

Nexus 7(2012版,升级到Android 4.4)
代码运行完成而没有崩溃.但是,在第一次调用Renderscript之后,更新ImageView会导致显示空白.显然输出位图没有正确写入.

华为Mate(Android 4.1.2)
从ADT加载后代码崩溃.下面是一系列错误消息(帖子主体限制为30k字符,因此我无法发布所有内容):

W/dalvikvm(2246): Refusing to reopen boot DEX '/system/framework/hwframework.jar'
E/RenderScript_jni(2246): No GC methods
D/dalvikvm(2246): Trying to load lib /data/data/com.xxx.renderscript.test/lib/libRSSupport.so 0x41726918
D/dalvikvm(2246): Added shared lib /data/data/com.xxx.renderscript.test/lib/libRSSupport.so 0x41726918
D/dalvikvm(2246): No JNI_OnLoad found in /data/data/com.xxx.renderscript.test/lib/libRSSupport.so 0x41726918,skipping init
D/dalvikvm(2246): Trying to load lib /data/data/com.xxx.renderscript.test/lib/librsjni.so 0x41726918
D/dalvikvm(2246): Added shared lib /data/data/com.xxx.renderscript.test/lib/librsjni.so 0x41726918
V/RenderScript_jni(2246): RS compat mode
V/RenderScript(2246): 0x5bc7d008 Launching thread(s),CPUs 3
E/RenderScript(2246): Unable to open shared library (/data/data/com.xxx.renderscript.test//lib/librs.flip.so): Cannot load library: reloc_library[1306]:   132 cannot locate '_Z13rsUptimeNanosv'...
E/RenderScript(2246): Unable to open system shared library (/system/lib/librs.flip.so): (null)
D/AndroidRuntime(2246): Shutting down VM
W/dalvikvm(2246): threadid=1: thread exiting with uncaught exception (group=0x40f122a0)
E/AndroidRuntime(2246): FATAL EXCEPTION: main
E/AndroidRuntime(2246): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.xxx.renderscript.test/com.xxx.renderscript.test.RenderScriptTestActivity}: android.support.v8.renderscript.RSRuntimeException: Loading of ScriptC script failed.

索尼Xperia Z Ultra C6802(Android 4.2.2)
从ADT加载后代码崩溃,并显示以下错误消息(再次选择以适应30k字符限制):

D/AndroidRuntime(3498): CheckJNI is OFF
D/dalvikvm(3498): Trying to load lib libjavacore.so 0x0
D/dalvikvm(3498): Added shared lib libjavacore.so 0x0
D/dalvikvm(3498): Trying to load lib libnativehelper.so 0x0
D/dalvikvm(3498): Added shared lib libnativehelper.so 0x0
I/ActivityManager(903): Start proc com.svox.pico for broadcast com.svox.pico/.VoiceDataInstallerReceiver: pid=3513 uid=10085 gids={50085,1015,1028}
I/ActivityManager(903): No longer want com.mobisystems.office:search (pid 2686): empty #34
I/ActivityManager(903): Start proc com.sonymobile.enterprise.service for broadcast com.sonymobile.enterprise.service/.Receiver: pid=3539 uid=1000 gids={41000,3003,1028,3002,3001,3007}
D/AndroidRuntime(3498): Calling main entry com.android.commands.am.Am
D/dalvikvm(3498): Note: class Landroid/app/ActivityManagerNative; has 157 unimplemented (abstract) methods
I/ActivityManager(903): START u0 {act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10000000 cmp=com.xxx.renderscript.test/.RenderScriptTestActivity} from pid 3498
D/AndroidRuntime(3498): Shutting down VM
D/jdwp(3498): Got wake-up signal,bailing out of select
D/dalvikvm(3498): Debugger has detached; object registry had 1 entries
D/dalvikvm(3557): Late-enabling CheckJNI
I/ActivityManager(903): Start proc com.xxx.renderscript.test for activity com.xxx.renderscript.test/.RenderScriptTestActivity: pid=3557 uid=10088 gids={50088,1028}
D/dalvikvm(3557): Debugger has detached; object registry had 1 entries
I/Icing.InternalIcingCorporaProvider(2583): Updating corpora: A: com.xxx.renderscript.test,C: MAYBE
E/.AppDataSearchProvider(2583): Could not connect to AppDataSearchClient to register corpora.
W/Icing.InternalIcingCorporaProvider(2583): Corpora registration failed
I/com.xxx.renderscript.test.RenderScriptTestActivity(3557): onCreate() 
E/.AppDataSearchProvider(2583): Could not connect to AppDataSearchClient for notifyTableChanged
W/Icing.InternalIcingCorporaProvider(2583): Application table change notification failed.
D/dalvikvm(2856): GC_CONCURRENT freed 187K,73% free 3028K/11084K,paused 3ms+4ms,total 20ms
D/ConnectionNotify(3116): queue add:2
D/AudioHardwareALSAExt(329): getParameters() supported_effect
D/[APP_SERVICE](3116): package com.xxx.renderscript.test installed
D/[APP_SERVICE](3116): add package com.xxx.renderscript.test
I/ActivityManager(903): Start proc com.UCMobile for broadcast com.UCMobile/.receivers.SysReceiver: pid=3587 uid=10207 gids={50207,1028}
I/dalvikvm(3587): Turning on JNI app bug workarounds for target SDK version 8...
D/dalvikvm(3410): GC_CONCURRENT freed 511K,71% free 3273K/11084K,paused 2ms+1ms,total 20ms
D/dalvikvm(3410): WAIT_FOR_CONCURRENT_GC blocked 5ms
E/RenderScript_jni(3557): No GC methods
D/dalvikvm(3557): Trying to load lib /data/app-lib/com.xxx.renderscript.test-1/libRSSupport.so 0x418243f8
D/dalvikvm(3557): Added shared lib /data/app-lib/com.xxx.renderscript.test-1/libRSSupport.so 0x418243f8
D/dalvikvm(3557): No JNI_OnLoad found in /data/app-lib/com.xxx.renderscript.test-1/libRSSupport.so 0x418243f8,skipping init
D/dalvikvm(3557): Trying to load lib /data/app-lib/com.xxx.renderscript.test-1/librsjni.so 0x418243f8
D/dalvikvm(3557): Added shared lib /data/app-lib/com.xxx.renderscript.test-1/librsjni.so 0x418243f8
V/RenderScript_jni(3557): RS compat mode
V/RenderScript(3557): 0x72b26978 Launching thread(s),CPUs 4
E/RenderScript(3557): Unable to open shared library (/data/data/com.xxx.renderscript.test//lib/librs.flip.so): Cannot load library: soinfo_relocate(linker.cpp:975): cannot locate symbol "_Z13rsUptimeNanosv" referenced by "librs.flip.so"...
E/RenderScript(3557): Unable to open system shared library (/system/lib/librs.flip.so): (null)
D/AndroidRuntime(3557): Shutting down VM
W/dalvikvm(3557): threadid=1: thread exiting with uncaught exception (group=0x4154aae0)
E/AndroidRuntime(3557): FATAL EXCEPTION: main
E/AndroidRuntime(3557): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.xxx.renderscript.test/com.xxx.renderscript.test.RenderScriptTestActivity}: android.support.v8.renderscript.RSRuntimeException: Loading of ScriptC script failed.
E/AndroidRuntime(3557):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2224)
E/AndroidRuntime(3557):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2274)
E/AndroidRuntime(3557):     at android.app.ActivityThread.access$600(ActivityThread.java:150)
E/AndroidRuntime(3557):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1276)
E/AndroidRuntime(3557):     at android.os.Handler.dispatchMessage(Handler.java:99)
E/AndroidRuntime(3557):     at android.os.Looper.loop(Looper.java:213)
E/AndroidRuntime(3557):     at android.app.ActivityThread.main(ActivityThread.java:5153)
E/AndroidRuntime(3557):     at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime(3557):     at java.lang.reflect.Method.invoke(Method.java:511)
E/AndroidRuntime(3557):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:797)
E/AndroidRuntime(3557):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:564)
E/AndroidRuntime(3557):     at dalvik.system.NativeStart.main(Native Method)
E/AndroidRuntime(3557): Caused by: android.support.v8.renderscript.RSRuntimeException: Loading of ScriptC script failed.
E/AndroidRuntime(3557):     at android.support.v8.renderscript.ScriptC.<init>(ScriptC.java:69)
E/AndroidRuntime(3557):     at com.xxx.renderscript.test.ScriptC_flip.<init>(ScriptC_flip.java:41)
E/AndroidRuntime(3557):     at com.xxx.renderscript.test.RenderScriptTestActivity.onCreate(RenderScriptTestActivity.java:53)
E/AndroidRuntime(3557):     at android.app.Activity.performCreate(Activity.java:5104)
E/AndroidRuntime(3557):     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1080)
E/AndroidRuntime(3557):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2188)
E/AndroidRuntime(3557):     ... 11 more
W/ActivityManager(903):   Force finishing activity com.xxx.renderscript.test/.RenderScriptTestActivity

如果有人可以查看问题,无论是我的代码中的错误还是Android SDK问题,我都会感激不尽.欢迎提出意见/建议谢谢!

[编辑]我从我的代码中删除了不相关的东西,并在这里发布完整的代码,希望有人可以重复我的问题,并找到解决方案.我还添加了更多的测试结果.

解决方法

好.我不确定这是否仍然需要,如果它能解决您的问题,但我建议您尝试使用Android插件来支持Gradle 1.5.0

这必须在项目的build.gradle中设置(不在app build.gradle中)

dependencies {
    classpath 'com.android.tools.build:gradle:1.5.0'
}

并使用buildToolsVersion 22.0.1或23.0.2或最新版本.

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐


摘要:本文由葡萄城技术团队于博客园发布。转载请注明出处:葡萄城官网,葡萄城为开发者提供专业的开发工具、解决方案和服务,赋能开发者。 前言 在Java编程中,循环结构是程序员常用的控制流程,而for循环和foreach循环是其中比较常见的两种形式。关于它们哪一个更快的讨论一直存在。本文旨在探究Java
摘要:本文由葡萄城技术团队于博客园原创并首发。转载请注明出处:葡萄城官网,葡萄城为开发者提供专业的开发工具、解决方案和服务,赋能开发者。 前言 把数据导出至 Excel 是很常见的需求,而数据的持久化,往往又放在数据库中。因此把数据库中的数据导出到 Excel中,成了非常普遍的一个需求。 以关系型数
前言 在Excel中创建的大多数商业报告不是单页的文档,而是包含了多个上下文相关的信息,这些信息被存储在多个工作表中。例如我们的一些地区销售报告、按部门分类的员工记录、每家店铺的库存清单等。 然而,随着Excel文件中工作表数量的增加,要在单一文档内导航和管理数据会变得十分具有挑战性。此外,因为这些
本文由葡萄城技术团队发布。转载请注明出处:葡萄城官网,葡萄城为开发者提供专业的开发工具、解决方案和服务,赋能开发者。 前言 本文小编将详细解析Spring Boot框架,并通过代码举例说明每个层的作用。我们将深入探讨Spring Boot的整体架构,包括展示层、业务逻辑层和数据访问层。通过这些例子,
摘要:本文由葡萄城技术团队原创并首发。转载请注明出处:葡萄城官网,葡萄城为开发者提供专业的开发工具、解决方案和服务,赋能开发者。 前言 在Java中,开发者可以使用一些开源的库(如Apache POI)来添加、修改和处理Excel中的数据:包括数字、文本、日期、列表等。每种数据验证类型都具有不同的参
摘要:本文由葡萄城技术团队于博客园原创并首发。转载请注明出处:葡萄城官网,葡萄城为开发者提供专业的开发工具、解决方案和服务,赋能开发者。 前言 Excel文件保护是常用的一种功能,文件保护主要有三种: 添加密码,如果没有密码不允许打开文件。 添加密码,如果没有密码,不能修改文件,但可以打开,只读以及
摘要:本文由葡萄城技术团队原创并首发。转载请注明出处:葡萄城官网,葡萄城为开发者提供专业的开发工具、解决方案和服务,赋能开发者。 前言 数据透视分析是一种强大的工具,可以帮助我们从大量数据中提取有用信息并进行深入分析。而在Java开发中,可以借助PivotTable,通过数据透视分析揭示数据中的隐藏
摘要:本文由葡萄城技术团队原创并首发。转载请注明出处:葡萄城官网,葡萄城为开发者提供专业的开发工具、解决方案和服务,赋能开发者。 前言 GrapeCity Documents for Excel(以下简称GcExcel)是葡萄城公司的一款支持批量创建、编辑、打印、导入/导出Excel文件的服务端表格
系列文章: 《还在担心报表不好做?不用怕,试试这个方法》(一) 《还在担心报表不好做?不用怕,试试这个方法》(二) 《还在担心报表不好做?不用怕,试试这个方法》(三) 概要 在上一篇文章《还在担心报表不好做?不用怕,试试这个方法》(三)中,小编为大家分享了数据间的主从关系及单元格布局。主要讲解数据之
前言 在现代软件开发中,重复性的增删改查逻辑代码的编写往往非常耗时且容易出错。为了提高开发效率,减少手动维护的成本,代码生成器就成为了一个非常重要的工具,本文小编就将为大家介绍一下如何利用一个开源项目快速生成数据接口。 实现方式 环境准备 技术栈:Java,Spring-Boot,MyBatisPl
引言 在当今快速发展的数字化时代,企业对业务应用的需求日益复杂且多元。低代码开发平台作为一个创新的解决方案,以直观易用的设计理念,打破了传统的编程壁垒,让非技术人员也能轻松构建功能完备的Web应用程序,无需深入编码。这一特性极大地简化了应用开发流程,加速了业务需求转化为实际应用的速度,为企业带来了前
系列文章: 《还在担心报表不好做?不用怕,试试这个方法》(一) 《还在担心报表不好做?不用怕,试试这个方法》(二) 概要 在上一篇文章《还在担心报表不好做?不用怕,试试这个方法》(二)中,小编介绍了模板语言中的的一些基本概念和用法,今天小编将继续为大家介绍如何不同字段间的父子关系,是如何在模板语言中
前言 随着软件开发的快速发展和需求的不断增长,开发人员面临着更多的压力和挑战。传统的开发方法需要花费大量的时间和精力,而低代码开发平台的出现为开发人员提供了一种更加高效、快速的开发方式。今天小编就以构建命令插件为例,展示如何使用Java语言高效构建自定义插件。 环境准备 活字格插件构建工具-Java
摘要:本文由葡萄城技术团队原创并首发。转载请注明出处:葡萄城官网,葡萄城为开发者提供专业的开发工具、解决方案和服务,赋能开发者。 前言 在实际开发过程中,经常会有这样的需求:将Excel表格或特定区域转换为图片,以便在其他软件中使用。而在Java开发中,借助于报表插件可以轻松地将工作表、任意指定区域
本文由葡萄城技术团队原创并首发。转载请注明出处:葡萄城官网,葡萄城为开发者提供专业的开发工具、解决方案和服务,赋能开发者。 什么是迭代计算 迭代计算其实是在 Excel 中,一种公式的循环引用,对于了解编程概念的同学,很容易会想到另一个词“递归”。 简单的说,就是一段程序调用自己,反复执行的逻辑。递
摘要:本文由葡萄城技术团队于博客园原创并首发。转载请注明出处:葡萄城官网,葡萄城为开发者提供专业的开发工具、解决方案和服务,赋能开发者。 前言 在Excel中设计表单时,我们经常需要对收集的信息进行统计分析。例如,学校给老师统计课时,医院给医护人员统计班次等。传统的手工方式需要逐个对比数据,然后将计
前言 在我们使用Excel时,经常会遇到一个问题,就是导入Excel时公式显示为【#Ref!】的情况。这通常是因为公式中引用的单元格已被删除或对应的工作表被删除,导致原公式无法识别对应的参数而显示为【#Ref!】。 比如在一张Excel表中,sheet1 中 A1 单元格的公式为‘=Sheet2!B
前言 Java是一种广泛使用的编程语言,它在企业级应用开发中发挥着重要作用。而在实际的开发过程中,我们常常需要处理各种数据格式转换的需求。今天小编为大家介绍下如何使用葡萄城公司的的Java API 组件GrapeCity Documents for Excel(以下简称为GcExcel)将Excel
摘要:本文由葡萄城技术团队原创并首发。转载请注明出处:葡萄城官网,葡萄城为开发者提供专业的开发工具、解决方案和服务,赋能开发者。 前言 在数据处理或者数据分析的场景中,需要对已有的数据进行排序,在Excel中可以通过排序功能进行整理数据。而在Java中,则可以借助Excel表格插件对数据进行批量排序
前言 GrapeCity Documents for Excel (以下简称GcExcel) 是葡萄城公司的一款服务端表格组件,它提供了一组全面的 API 以编程方式生成 Excel (XLSX) 电子表格文档的功能,支持为多个平台创建、操作、转换和共享与 Microsoft Excel 兼容的电子